Update application bootstrapping to load .env from repo root

This commit is contained in:
Garrett Mills 2022-07-08 20:56:48 -05:00
parent 2ff9354538
commit d3a6a8495c
2 changed files with 12 additions and 4 deletions

View File

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

View File

@ -242,14 +242,22 @@ export class Application extends Container {
* @protected
*/
protected bootstrapEnvironment(): void {
logIfDebugging('extollo.env', `.env path: ${this.basePath.concat('.env').toLocal}`)
const path = this.basePath.concat('.env').toLocal
let 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) ) {
dotenv.config({
path,
})
}
logIfDebugging('extollo.env', process.env)
}
/**