Merge pull request #6928 from overleaf/msm-fix-config-lookup-ce

[settings] use entry point file to locate config

GitOrigin-RevId: 7e860233619a8c51929ca9d363e0a82454cd0c2a
This commit is contained in:
Miguel Serrano 2022-03-02 12:27:48 +01:00 committed by Copybot
parent f8988e8087
commit e9a4ae027d

View file

@ -4,12 +4,15 @@ const Path = require('path')
const { merge } = require('./merge')
const CWD = process.cwd()
const ENTRY_POINT_DIR = Path.dirname(process.argv[1])
const NODE_ENV = (process.env.NODE_ENV || 'development').toLowerCase()
const SHARELATEX_CONFIG = process.env.SHARELATEX_CONFIG
let settings
let settingsExist = false
const defaultsPath = pathIfExists(Path.join(CWD, 'config/settings.defaults.js'))
const defaultsPath =
pathIfExists(Path.join(CWD, 'config/settings.defaults.js')) ||
pathIfExists(Path.join(ENTRY_POINT_DIR, 'config/settings.defaults.js'))
if (defaultsPath) {
console.log(`Using default settings from ${defaultsPath}`)
settings = require(defaultsPath)