Only load .env if the file exists; bump version

This commit is contained in:
Garrett Mills 2022-03-31 15:53:36 -05:00
parent a779ec1d09
commit 25265b5560
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@extollo/lib", "name": "@extollo/lib",
"version": "0.9.21", "version": "0.9.22",
"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",

View File

@ -16,6 +16,7 @@ import {
import {Logging} from '../service/Logging' import {Logging} from '../service/Logging'
import {RunLevelErrorHandler} from './RunLevelErrorHandler' import {RunLevelErrorHandler} from './RunLevelErrorHandler'
import {Unit, UnitStatus} from './Unit' import {Unit, UnitStatus} from './Unit'
import * as fs from 'fs'
import * as dotenv from 'dotenv' import * as dotenv from 'dotenv'
import {CacheFactory} from '../support/cache/CacheFactory' import {CacheFactory} from '../support/cache/CacheFactory'
@ -242,9 +243,12 @@ export class Application extends Container {
*/ */
protected bootstrapEnvironment(): void { protected bootstrapEnvironment(): void {
logIfDebugging('extollo.env', `.env path: ${this.basePath.concat('.env').toLocal}`) logIfDebugging('extollo.env', `.env path: ${this.basePath.concat('.env').toLocal}`)
const path = this.basePath.concat('.env').toLocal
if ( fs.existsSync(path) ) {
dotenv.config({ dotenv.config({
path: this.basePath.concat('.env').toLocal, path,
}) })
}
logIfDebugging('extollo.env', process.env) logIfDebugging('extollo.env', process.env)
} }