diff --git a/CHANGELOG.md b/CHANGELOG.md index ab9398c..019841d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 1.1.4 - 1/17/24 +Minor change to where resetting dotenv fields is called. + ## 1.1.3 - 1/17/24 Update README.md to notify users about input path validation. diff --git a/package.json b/package.json index 529bd84..abd6329 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-app-config", - "version": "1.1.3", + "version": "1.1.4", "description": "A simple configuration manager for different environments", "license": "MIT", "repository": { diff --git a/src/simple-app-config.ts b/src/simple-app-config.ts index e3b13a8..7ba3d65 100644 --- a/src/simple-app-config.ts +++ b/src/simple-app-config.ts @@ -290,13 +290,9 @@ export class Config { * - Environment variables * - The path corresponding to the environment * - * If the path specified in each of the above doesn't exist, it will try the next highest priority value. Clears previously - * loaded values from a .env file + * If the path specified in each of the above doesn't exist, it will try the next highest priority value. */ private static findEnvFile(): string | undefined { - /* Reset previously set dotenv values */ - Config.resetDotEnv(); - /* Load path specified by command line argument if it exists */ for (const arg of process.argv) { if (arg.startsWith(CommandLineArgs.EnvPath)) { @@ -332,9 +328,12 @@ export class Config { } /** - * Loads the .env file if it has been found and set. + * Loads the .env file if it has been found and set. Clears previously loaded values from a .env file */ private static loadEnvFile(path: string | undefined): void { + /* Reset previously set dotenv values */ + Config.resetDotEnv(); + if (path !== undefined) { dotenv.config({ path: path }); Config.prevDotenvValues = dotenv.parse(fs.readFileSync(path)); /* Set prev dotenv values */