2019-02-19 11:34:52 +00:00
|
|
|
import _ from 'lodash'
|
2021-01-04 17:47:59 +00:00
|
|
|
import nconf from 'nconf-lite'
|
2019-02-19 11:34:52 +00:00
|
|
|
import { readFileSync } from 'fs'
|
|
|
|
|
|
|
|
// Helper method for global usage.
|
|
|
|
nconf.inTest = () => nconf.get('NODE_ENV') === 'test'
|
|
|
|
|
|
|
|
// Config follow the following priority check order:
|
|
|
|
// 1. Enviroment variables
|
|
|
|
// 2. package.json
|
|
|
|
// 3. config/config.json
|
|
|
|
// 4. config/config.default.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load enviroment variables as first priority
|
|
|
|
nconf.env({
|
|
|
|
separator: '__',
|
|
|
|
whitelist: [
|
|
|
|
'DATABASE_URL',
|
|
|
|
'NODE_ENV',
|
|
|
|
'server__port',
|
|
|
|
'server__host',
|
|
|
|
'knex__connection__host',
|
|
|
|
'knex__connection__user',
|
|
|
|
'knex__connection__database',
|
|
|
|
'knex__connection__password',
|
2019-09-14 19:03:38 +00:00
|
|
|
'knex__connectionslave__host',
|
|
|
|
'knex__connectionslave__user',
|
|
|
|
'knex__connectionslave__database',
|
|
|
|
'knex__connectionslave__password',
|
|
|
|
'upload__baseurl',
|
|
|
|
'upload__port',
|
|
|
|
'upload__host',
|
|
|
|
'upload__name',
|
|
|
|
'upload__secret',
|
2019-02-19 11:34:52 +00:00
|
|
|
'bunyan__name',
|
|
|
|
'frontend__url',
|
|
|
|
'jwt__secret',
|
|
|
|
'sessionsecret',
|
|
|
|
'bcrypt',
|
|
|
|
'name',
|
|
|
|
'NODE_VERSION',
|
|
|
|
],
|
|
|
|
parseValues: true,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2022-04-05 16:47:24 +00:00
|
|
|
// Load empty overrides that can be overwritten later
|
|
|
|
nconf.overrides({})
|
|
|
|
|
|
|
|
nconf.defaults({
|
|
|
|
"NODE_ENV": "development",
|
|
|
|
"frontend": {
|
|
|
|
"url": "http://beta01.nfp.moe"
|
|
|
|
},
|
2022-07-20 00:33:06 +00:00
|
|
|
"jwtsecret": "w2bkdWAButfdfEkCs8dpE3L2n6QzCfhna0T4",
|
2022-04-19 17:42:07 +00:00
|
|
|
"mssql": {
|
2022-06-16 22:44:43 +00:00
|
|
|
"conn_timeout": 5,
|
2022-04-19 17:42:07 +00:00
|
|
|
"floor": 1,
|
|
|
|
"ceiling": 2,
|
|
|
|
"heartbeatSecs": 20,
|
|
|
|
"inactivityTimeoutSecs": 60,
|
|
|
|
"connectionString": "Driver={ODBC Driver 17 for SQL Server}; Server=localhost;UID=dev; PWD=dev; Database=nfp_moe",
|
|
|
|
},
|
2022-07-20 00:33:06 +00:00
|
|
|
"media": {
|
|
|
|
"secret": "upload-secret-key-here",
|
|
|
|
"iss": "dev",
|
|
|
|
"path": "https://media.nfp.is/media/resize",
|
|
|
|
"preview": {
|
|
|
|
"out": "base64",
|
|
|
|
"format": "avif",
|
|
|
|
"blur": 10,
|
|
|
|
"resize": {
|
|
|
|
"width": 300,
|
|
|
|
"height": 300,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"quality": 50,
|
|
|
|
"effort": 4
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"small": {
|
|
|
|
"jpeg": {
|
|
|
|
"format": "jpeg",
|
|
|
|
"resize": {
|
|
|
|
"width": 720,
|
|
|
|
"height": 720,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"jpeg": {
|
|
|
|
"quality": 93
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"format": "avif",
|
|
|
|
"resize": {
|
|
|
|
"width": 720,
|
|
|
|
"height": 720,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"quality": 60,
|
|
|
|
"effort": 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"medium": {
|
|
|
|
"jpeg": {
|
|
|
|
"format": "jpeg",
|
|
|
|
"resize": {
|
|
|
|
"width": 1300,
|
|
|
|
"height": 1300,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"jpeg": {
|
|
|
|
"quality": 93
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"format": "avif",
|
|
|
|
"resize": {
|
|
|
|
"width": 1300,
|
|
|
|
"height": 1300,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"quality": 75,
|
|
|
|
"effort": 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"large": {
|
|
|
|
"jpeg": {
|
|
|
|
"format": "jpeg",
|
|
|
|
"resize": {
|
|
|
|
"width": 3000,
|
|
|
|
"height": 3000,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"jpeg": {
|
|
|
|
"quality": 95
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"format": "avif",
|
|
|
|
"resize": {
|
|
|
|
"width": 3000,
|
|
|
|
"height": 3000,
|
|
|
|
"fit": "inside",
|
|
|
|
"withoutEnlargement": true,
|
|
|
|
"kernel": "lanczos3"
|
|
|
|
},
|
|
|
|
"avif": {
|
|
|
|
"quality": 85,
|
|
|
|
"effort": 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2022-04-05 16:47:24 +00:00
|
|
|
"fileSize": 524288000,
|
|
|
|
"upload": {
|
|
|
|
"baseurl": "https://cdn.nfp.is",
|
|
|
|
"port": "2111",
|
|
|
|
"host": "storage01.nfp.is",
|
|
|
|
"name": "nfpmoe-dev",
|
|
|
|
"secret": "nfpmoe-dev"
|
|
|
|
}
|
|
|
|
})
|
2019-02-19 11:34:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
export default nconf
|