diff --git a/changelog.md b/changelog.md index e51bee2..264d982 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-11-18 - 6.0.7 - fix(Qenv) +Fix file path initialization for environment variable files + +- Corrected the logic for determining the absolute path for environment files +- Added missing initialization for env.yml file paths + ## 2024-11-18 - 6.0.6 - fix(core) Improve handling of env.json and env.yml file checks diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 7680486..1cb3c07 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/qenv', - version: '6.0.6', + version: '6.0.7', description: 'A module for easily handling environment variables in Node.js projects with support for .yml and .json configuration.' } diff --git a/ts/qenv.classes.qenv.ts b/ts/qenv.classes.qenv.ts index 9ada42f..6be6070 100644 --- a/ts/qenv.classes.qenv.ts +++ b/ts/qenv.classes.qenv.ts @@ -37,17 +37,24 @@ export class Qenv { plugins.path.resolve(envFileBasePathArg), 'env.json' ); - const envFileYamlPath = this.envFilePathAbsolute = plugins.path.join( + const envFileYmlPath = this.envFilePathAbsolute = plugins.path.join( plugins.path.resolve(envFileBasePathArg), 'env.yml' ); + const envFileYamlPath = this.envFilePathAbsolute = plugins.path.join( + plugins.path.resolve(envFileBasePathArg), + 'env.yaml' + ); const envFileJsonExists = plugins.smartfile.fs.fileExistsSync(envFileJsonPath); + const envFileYmlExists = plugins.smartfile.fs.fileExistsSync(envFileYmlPath); const envFileYamlExists = plugins.smartfile.fs.fileExistsSync(envFileYamlPath); - if (envFileJsonExists && envFileYamlExists) { + if (envFileJsonExists && (envFileYamlExists || envFileYmlExists)) { this.logger.log('warn', 'Both env.json and env.yml files exist! Using env.json'); } else if (envFileJsonExists) { this.envFilePathAbsolute = envFileJsonPath; + } else if (envFileYmlExists) { + this.envFilePathAbsolute = envFileYmlPath; } else if (envFileYamlExists) { this.envFilePathAbsolute = envFileYamlPath; }