Update application bootstrapping to load .env from repo root

master
Garrett Mills 2 years ago
parent 2ff9354538
commit d3a6a8495c

@ -1,6 +1,6 @@
{ {
"name": "@extollo/lib", "name": "@extollo/lib",
"version": "0.10.0", "version": "0.10.1",
"description": "The framework library that lifts up your code.", "description": "The framework library that lifts up your code.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

@ -242,14 +242,22 @@ export class Application extends Container {
* @protected * @protected
*/ */
protected bootstrapEnvironment(): void { protected bootstrapEnvironment(): void {
logIfDebugging('extollo.env', `.env path: ${this.basePath.concat('.env').toLocal}`) let path = this.basePath.concat('.env').toLocal
const path = this.basePath.concat('.env').toLocal logIfDebugging('extollo.env', `Trying .env path: ${path}`)
if ( fs.existsSync(path) ) {
dotenv.config({
path,
})
return
}
path = this.basePath.concat('../.env').toLocal
logIfDebugging('extollo.env', `Trying .env path: ${path}`)
if ( fs.existsSync(path) ) { if ( fs.existsSync(path) ) {
dotenv.config({ dotenv.config({
path, path,
}) })
} }
logIfDebugging('extollo.env', process.env)
} }
/** /**

Loading…
Cancel
Save