summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/config/default.js4
-rw-r--r--lib/config/environment.js2
-rw-r--r--lib/config/index.js10
-rw-r--r--lib/web/imageRouter.js4
4 files changed, 14 insertions, 6 deletions
diff --git a/lib/config/default.js b/lib/config/default.js
index 28f4490c..38dc21a4 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -53,7 +53,9 @@ module.exports = {
// document
documentmaxlength: 100000,
// image upload setting, available options are imgur/s3/filesystem
- imageUploadType: 'filesystem',
+ imageuploadtype: 'filesystem',
+ // legacy variable name for imageuploadtype
+ imageUploadType: undefined,
imgur: {
clientID: undefined
},
diff --git a/lib/config/environment.js b/lib/config/environment.js
index e2112b6a..640f9e07 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -25,7 +25,7 @@ module.exports = {
allowfreeurl: toBooleanConfig(process.env.HMD_ALLOW_FREEURL),
defaultpermission: process.env.HMD_DEFAULT_PERMISSION,
dburl: process.env.HMD_DB_URL,
- imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE,
+ imageuploadtype: process.env.HMD_IMAGE_UPLOAD_TYPE,
imgur: {
clientID: process.env.HMD_IMGUR_CLIENTID
},
diff --git a/lib/config/index.js b/lib/config/index.js
index 4f6b4b6a..0051e485 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -13,6 +13,7 @@ const debugConfig = {
debug: (env === Environment.development)
}
+// Get version string from package.json
const {version} = require(path.join(appRootPath, 'package.json'))
const packageConfig = {
@@ -20,7 +21,7 @@ const packageConfig = {
minimumCompatibleVersion: '0.5.0'
}
-const configFilePath = path.join(__dirname, '../../config.json')
+const configFilePath = path.join(appRootPath, 'config.json')
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
let config = require('./default')
@@ -97,8 +98,13 @@ config.isLDAPEnable = config.ldap.url
config.isSAMLEnable = config.saml.idpSsoUrl
config.isPDFExportEnable = config.allowpdfexport
+// merge legacy values
+if (config.imageUploadType && !config.imageuploadtype) {
+ config.imageuploadtype = config.imageUploadType
+}
+
// figure out mime types for image uploads
-switch (config.imageUploadType) {
+switch (config.imageuploadtype) {
case 'imgur':
config.allowedUploadMimeTypes = [
'image/jpeg',
diff --git a/lib/web/imageRouter.js b/lib/web/imageRouter.js
index b17cccbd..483be64b 100644
--- a/lib/web/imageRouter.js
+++ b/lib/web/imageRouter.js
@@ -19,7 +19,7 @@ imageRouter.post('/uploadimage', function (req, res) {
form.keepExtensions = true
- if (config.imageUploadType === 'filesystem') {
+ if (config.imageuploadtype === 'filesystem') {
form.uploadDir = 'public/uploads'
}
@@ -30,7 +30,7 @@ imageRouter.post('/uploadimage', function (req, res) {
if (config.debug) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) }
try {
- switch (config.imageUploadType) {
+ switch (config.imageuploadtype) {
case 'filesystem':
res.send({
link: url.resolve(config.serverurl + '/', files.image.path.match(/^public\/(.+$)/)[1])