mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Take config from SHARELATEX_CONFIG env variable
This commit is contained in:
parent
3133f85164
commit
6baf4ebe85
2 changed files with 26 additions and 4 deletions
19
libraries/settings/README.md
Normal file
19
libraries/settings/README.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
settings-sharelatex
|
||||||
|
===================
|
||||||
|
|
||||||
|
A small module to allow global config settings to be set for all services
|
||||||
|
within the ShareLaTeX architecture.
|
||||||
|
|
||||||
|
Settings file location
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
You can specify a custom location for the settings file by setting the
|
||||||
|
`SHARELATEX_CONFIG` environment variable. E.g.
|
||||||
|
|
||||||
|
$ export SHARELATEX_CONFIG=/home/james/config/settings.development.coffee
|
||||||
|
|
||||||
|
Otherwise, the settings will be loaded from `config/settings.NODE_ENV.coffee`,
|
||||||
|
where `NODE_ENV` is another evnironment variable, or defaults to `development`.
|
||||||
|
|
||||||
|
The config directory is first looked for in the current directory, and then relative
|
||||||
|
to the settings module directory.
|
|
@ -2,10 +2,13 @@ fs = require "fs"
|
||||||
path = require "path"
|
path = require "path"
|
||||||
env = (process.env.NODE_ENV or "development").toLowerCase()
|
env = (process.env.NODE_ENV or "development").toLowerCase()
|
||||||
|
|
||||||
possibleConfigFiles = [
|
if process.env.SHARELATEX_CONFIG?
|
||||||
process.cwd() + "/config/settings.#{env}.coffee"
|
possibleConfigFiles = [process.env.SHARELATEX_CONFIG]
|
||||||
path.normalize(__dirname + "/../../config/settings.#{env}.coffee")
|
else
|
||||||
]
|
possibleConfigFiles = [
|
||||||
|
process.cwd() + "/config/settings.#{env}.coffee"
|
||||||
|
path.normalize(__dirname + "/../../config/settings.#{env}.coffee")
|
||||||
|
]
|
||||||
|
|
||||||
for file in possibleConfigFiles
|
for file in possibleConfigFiles
|
||||||
if fs.existsSync(file)
|
if fs.existsSync(file)
|
||||||
|
|
Loading…
Reference in a new issue