Remove camel case from imageuploadtype in config

This removes the only camel cased option of the config options
**we** added to the config.json.

In auth provider's config parts are a lot of camel cased options
provided. We shouldn't touch them to keep them as similar as
possible to the examples.

Fixes #315

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2018-01-26 14:00:48 +01:00
parent 0138911274
commit bd92010dd2
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD
7 changed files with 21 additions and 13 deletions

View file

@ -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
},

View file

@ -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
},

View file

@ -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',