fix(Qenv): Fix environment file path initialization logic.
This commit is contained in:
parent
df35680dea
commit
b9677b110c
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-11-18 - 6.0.8 - fix(Qenv)
|
||||||
|
Fix environment file path initialization logic.
|
||||||
|
|
||||||
|
- Corrected the logic for setting the environment file paths to prevent overwriting each other.
|
||||||
|
|
||||||
## 2024-11-18 - 6.0.7 - fix(Qenv)
|
## 2024-11-18 - 6.0.7 - fix(Qenv)
|
||||||
Fix file path initialization for environment variable files
|
Fix file path initialization for environment variable files
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/qenv',
|
name: '@push.rocks/qenv',
|
||||||
version: '6.0.7',
|
version: '6.0.8',
|
||||||
description: 'A module for easily handling environment variables in Node.js projects with support for .yml and .json configuration.'
|
description: 'A module for easily handling environment variables in Node.js projects with support for .yml and .json configuration.'
|
||||||
}
|
}
|
||||||
|
@ -32,25 +32,21 @@ export class Qenv {
|
|||||||
plugins.path.resolve(qenvFileBasePathArg),
|
plugins.path.resolve(qenvFileBasePathArg),
|
||||||
'qenv.yml'
|
'qenv.yml'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (envFileBasePathArg) {
|
if (envFileBasePathArg) {
|
||||||
const envFileJsonPath = this.envFilePathAbsolute = plugins.path.join(
|
const envFileBasePath = plugins.path.resolve(envFileBasePathArg);
|
||||||
plugins.path.resolve(envFileBasePathArg),
|
|
||||||
'env.json'
|
const envFileJsonPath = plugins.path.join(envFileBasePath, 'env.json');
|
||||||
);
|
const envFileYmlPath = plugins.path.join(envFileBasePath, 'env.yml');
|
||||||
const envFileYmlPath = this.envFilePathAbsolute = plugins.path.join(
|
const envFileYamlPath = plugins.path.join(envFileBasePath, 'env.yaml');
|
||||||
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 envFileJsonExists = plugins.smartfile.fs.fileExistsSync(envFileJsonPath);
|
||||||
const envFileYmlExists = plugins.smartfile.fs.fileExistsSync(envFileYmlPath);
|
const envFileYmlExists = plugins.smartfile.fs.fileExistsSync(envFileYmlPath);
|
||||||
const envFileYamlExists = plugins.smartfile.fs.fileExistsSync(envFileYamlPath);
|
const envFileYamlExists = plugins.smartfile.fs.fileExistsSync(envFileYamlPath);
|
||||||
|
|
||||||
if (envFileJsonExists && (envFileYamlExists || envFileYmlExists)) {
|
if (envFileJsonExists && (envFileYmlExists || envFileYamlExists)) {
|
||||||
this.logger.log('warn', 'Both env.json and env.yml files exist! Using env.json');
|
this.logger.log('warn', 'Both env.json and env.yml files exist! Using env.json');
|
||||||
|
this.envFilePathAbsolute = envFileJsonPath;
|
||||||
} else if (envFileJsonExists) {
|
} else if (envFileJsonExists) {
|
||||||
this.envFilePathAbsolute = envFileJsonPath;
|
this.envFilePathAbsolute = envFileJsonPath;
|
||||||
} else if (envFileYmlExists) {
|
} else if (envFileYmlExists) {
|
||||||
|
Loading…
Reference in New Issue
Block a user