hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.32k stars 1.06k forks source link

How to configure CodiMD with environment variables #1759

Closed Musicminion closed 2 years ago

Musicminion commented 2 years ago

How to configure CodiMD with environment variables ?Can any one help me?

jackycute commented 2 years ago

Please take a look at https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration Thank you!

1ter commented 6 months ago

Please take a look at https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration Thank you!

If I execute a shell inside docker codimd container I can get environment.js file but it's content isn't as I'd expect. I expected a true or false dict, but not a allowEmailRegister: toBooleanConfig(process.env.CMD_ALLOW_EMAIL_REGISTER). Can this value be modified to just literal true or false?

'use strict'                                                                                                              

const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')                                            

module.exports = {                                                                                                        
  sourceURL: process.env.CMD_SOURCE_URL,                                                                                  
  domain: process.env.CMD_DOMAIN,                                                                                         
  urlPath: process.env.CMD_URL_PATH,                                                                                      
  host: process.env.CMD_HOST,                                                                                             
  port: toIntegerConfig(process.env.CMD_PORT),                                                                            
  path: process.env.CMD_PATH,                                                                                             
  loglevel: process.env.CMD_LOGLEVEL,                                                                                     
  urlAddPort: toBooleanConfig(process.env.CMD_URL_ADDPORT),                                                               
  useSSL: toBooleanConfig(process.env.CMD_USESSL),                                                                        
  hsts: {
    enable: toBooleanConfig(process.env.CMD_HSTS_ENABLE),
    maxAgeSeconds: toIntegerConfig(process.env.CMD_HSTS_MAX_AGE),
    includeSubdomains: toBooleanConfig(process.env.CMD_HSTS_INCLUDE_SUBDOMAINS),
    preload: toBooleanConfig(process.env.CMD_HSTS_PRELOAD)

(...)

If I'd like to change value of includeSubdomains: toBooleanConfig(process.env.CMD_HSTS_INCLUDE_SUBDOMAINS), to true or false, this could work?

(...)
    includeSubdomains: toBooleanConfig(true),
(...)

It doesn't seem to work that way, and Documentation isn't explaining that either. Sorry for my lack of knowledge in this issue. I really appreciate the help.