Compare commits

...

4 Commits

Author SHA1 Message Date
76e72e2a28 4.0.3 2019-08-29 14:19:16 +02:00
697eb83390 fix(core): update 2019-08-29 14:19:15 +02:00
00ec15ccf7 4.0.2 2019-08-06 17:41:46 +02:00
b54a5e2fef fix(core): update 2019-08-06 17:41:45 +02:00
6 changed files with 13 additions and 9 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/qenv",
"version": "4.0.1",
"version": "4.0.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -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
View File

@ -0,0 +1,4 @@
{
"key1": "fromJson",
"key2" :"fromJson"
}

View File

@ -1,2 +0,0 @@
key1: fromYml
key2: fromYml

View File

@ -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();

View File

@ -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`);