Seiya Tashiro 7 лет назад
Родитель
Сommit
1187cf3474
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      src/server/models/config.js

+ 18 - 0
src/server/models/config.js

@@ -129,6 +129,12 @@ module.exports = function(crowi) {
     };
   }
 
+  function getDefaultEnv() {
+    return {
+      'USER_UPPER_LIMIT': 0,
+    };
+  }
+
   function getValueForCrowiNS(config, key) {
     // return the default value if undefined
     if (undefined === config.crowi || undefined === config.crowi[key]) {
@@ -147,6 +153,13 @@ module.exports = function(crowi) {
     return config.markdown[key];
   }
 
+  function getValueEnv(crowi, key) {
+    if (null == crowi.env || null == crowi.env[key]) {
+      return getDefaultEnv()[key];
+    }
+    return crowi.env[key];
+  }
+
   configSchema.statics.getRestrictGuestModeLabels = function() {
     var labels = {};
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
@@ -597,6 +610,11 @@ module.exports = function(crowi) {
     return local_config;
   };
 
+  configSchema.statics.userUpperLimit = function(crowi) {
+    const key = 'USER_UPPER_LIMIT';
+    return Number(getValueEnv(crowi, key));
+  };
+
   /*
   configSchema.statics.isInstalled = function(config)
   {