+ VIDEO_MIMETYPE_EXT,
+ AVATAR_MIMETYPE_EXT,
+ SCHEDULER_INTERVAL,
+ JOB_COMPLETED_LIFETIME
+}
+
+// ---------------------------------------------------------------------------
+
+function getLocalConfigFilePath () {
+ const configSources = config.util.getConfigSources()
+ if (configSources.length === 0) throw new Error('Invalid config source.')
+
+ let filename = 'local'
+ if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`
+ if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`
+
+ return join(dirname(configSources[ 0 ].name), filename + '.json')
+}
+
+function updateWebserverConfig () {
+ CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT)
+ CONFIG.WEBSERVER.HOST = sanitizeHost(CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT, REMOTE_SCHEME.HTTP)
+}
+
+export function reloadConfig () {
+
+ function directory () {
+ if (process.env.NODE_CONFIG_DIR) {
+ return process.env.NODE_CONFIG_DIR
+ }
+
+ return join(root(), 'config')
+ }
+
+ function purge () {
+ for (const fileName in require.cache) {
+ if (-1 === fileName.indexOf(directory())) {
+ continue
+ }
+
+ delete require.cache[fileName]
+ }
+
+ delete require.cache[require.resolve('config')]
+ }
+
+ purge()
+
+ config = require('config')
+
+ updateWebserverConfig()