Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
76e72e2a28 | |||
697eb83390 | |||
00ec15ccf7 | |||
b54a5e2fef |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/qenv",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/qenv",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.3",
|
||||
"private": false,
|
||||
"description": "easy promised environments",
|
||||
"main": "dist/index.js",
|
||||
|
4
test/assets/env.json
Normal file
4
test/assets/env.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"key1": "fromJson",
|
||||
"key2" :"fromJson"
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
key1: fromYml
|
||||
key2: fromYml
|
@ -17,13 +17,13 @@ tap.test('key1 should be not be overwritten since it is already present', async
|
||||
});
|
||||
|
||||
tap.test('key2 should be read from Yml', async () => {
|
||||
expect(testQenv.getEnvVarRequired('key2')).to.equal('fromYml');
|
||||
expect(testQenv.getEnvVarOnDemand('key2')).to.equal('fromYml');
|
||||
expect(testQenv.getEnvVarRequired('key2')).to.equal('fromJson');
|
||||
expect(testQenv.getEnvVarOnDemand('key2')).to.equal('fromJson');
|
||||
});
|
||||
|
||||
tap.test('keyValueObjectArray should hold all retrieved values', async () => {
|
||||
expect(testQenv.keyValueObject.key1).to.equal('original');
|
||||
expect(testQenv.keyValueObject.key2).to.equal('fromYml');
|
||||
expect(testQenv.keyValueObject.key2).to.equal('fromJson');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -31,7 +31,7 @@ export class Qenv {
|
||||
);
|
||||
this.envFilePathAbsolute = plugins.path.join(
|
||||
plugins.path.resolve(envFileBasePathArg),
|
||||
'env.yml'
|
||||
'env.json'
|
||||
);
|
||||
|
||||
this.getRequiredEnvVars();
|
||||
@ -48,6 +48,8 @@ export class Qenv {
|
||||
if (failOnMissing) {
|
||||
console.error('Exiting!');
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('qenv is not set to fail on missing environment variables');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,7 +133,7 @@ export class Qenv {
|
||||
this.logger.log('ok', `found ${requiredEnvVar} as environment variable`);
|
||||
chosenVar = envVar;
|
||||
} else if (envFileVar) {
|
||||
this.logger.log('ok', `found ${requiredEnvVar} as env.yml variable`);
|
||||
this.logger.log('ok', `found ${requiredEnvVar} as env.json variable`);
|
||||
chosenVar = envFileVar;
|
||||
} else if (dockerSecret) {
|
||||
this.logger.log('ok', `found ${requiredEnvVar} as docker secret`);
|
||||
|
Reference in New Issue
Block a user