Merge pull request #2 from sharelatex/afc-js-settings

Allow .js setting files
This commit is contained in:
nate stemen 2018-12-19 15:18:08 -05:00 committed by GitHub
commit efadf662f2
2 changed files with 5 additions and 4 deletions

View file

@ -10,9 +10,9 @@ merge = (settings, defaults) ->
defaults[key] = value
return defaults
defaultSettingsPath = path.normalize(__dirname + "/../../config/settings.defaults.coffee")
defaultSettingsPath = path.normalize(__dirname + "/../../config/settings.defaults")
if fs.existsSync(defaultSettingsPath)
if fs.existsSync("#{defaultSettingsPath}.coffee") or fs.existsSync("#{defaultSettingsPath}.js")
defaults = require(defaultSettingsPath)
settingsExist = true
else
@ -23,6 +23,8 @@ if process.env.SHARELATEX_CONFIG?
possibleConfigFiles = [process.env.SHARELATEX_CONFIG]
else
possibleConfigFiles = [
process.cwd() + "/config/settings.#{env}.js"
path.normalize(__dirname + "/../../config/settings.#{env}.js")
process.cwd() + "/config/settings.#{env}.coffee"
path.normalize(__dirname + "/../../config/settings.#{env}.coffee")
]
@ -37,4 +39,3 @@ if !settingsExist
console.warn "No settings or defaults found. I'm flying blind."
module.exports = defaults

View file

@ -2,7 +2,7 @@
"name": "settings-sharelatex",
"homepage": "www.sharelatex.com",
"description": "A centralised settings system for ShareLaTeX",
"version": "1.0.0",
"version": "1.1.0",
"repository": {
"type": "git",
"url": "https://github.com/sharelatex/settings-sharelatex.git"