NGPixel 8 лет назад
Родитель
Сommit
bad59d1a99
3 измененных файлов с 12 добавлено и 8 удалено
  1. 10 0
      libs/config.js
  2. 0 6
      libs/db.js
  3. 2 2
      views/configure/index.pug

+ 10 - 0
libs/config.js

@@ -33,6 +33,16 @@ module.exports = (confPaths) => {
 
 
   appconfig = _.defaultsDeep(appconfig, appdata.defaults.config)
   appconfig = _.defaultsDeep(appconfig, appdata.defaults.config)
 
 
+  // Using ENV variables?
+
+  if (appconfig.port < 1) {
+    appconfig.port = process.env.PORT || 80
+  }
+
+  if (_.startsWith(appconfig.db, '$')) {
+    appconfig.db = process.env[appconfig.db.slice(1)]
+  }
+
   // List authentication strategies
   // List authentication strategies
 
 
   if (appdata.capabilities.manyAuthProviders) {
   if (appdata.capabilities.manyAuthProviders) {

+ 0 - 6
libs/db.js

@@ -54,12 +54,6 @@ module.exports = {
       self[modelName] = require(path.join(dbModelsPath, file))
       self[modelName] = require(path.join(dbModelsPath, file))
     })
     })
 
 
-    // Using ENV variable?
-
-    if (_.startsWith(appconfig.db, '$')) {
-      appconfig.db = process.env[appconfig.db.slice(1)]
-    }
-
     // Connect
     // Connect
 
 
     self.onReady = modb.connect(appconfig.db)
     self.onReady = modb.connect(appconfig.db)

+ 2 - 2
views/configure/index.pug

@@ -95,8 +95,8 @@ html(data-logic='configure')
                   section
                   section
                     p.control
                     p.control
                       label.label Port
                       label.label Port
-                      input(type='text', placeholder='e.g. 80', v-model.number='conf.port', data-vv-scope='general', name='ipt-port', v-validate='{ required: true, numeric: true, min_value: 1, max_value: 65535 }')
-                      span.desc The port on which Wiki.js will listen to. Usually port 80 if connecting directly, or a random port (e.g. 3000) if using a web server in front of it.
+                      input(type='text', placeholder='e.g. 80', v-model.number='conf.port', data-vv-scope='general', name='ipt-port', v-validate='{ required: true, numeric: true, min_value: 0, max_value: 65535 }')
+                      span.desc The port on which Wiki.js will listen to. Usually port 80 if connecting directly, or a random port (e.g. 3000) if using a web server in front of it.<br>Set <strong>0</strong> to use $PORT system environment variable.
                   section
                   section
                     p.control
                     p.control
                       label.label Site UI Language
                       label.label Site UI Language