Compare commits

...

20 Commits

Author SHA1 Message Date
f61c0da30a 5.0.2 2022-08-02 14:50:18 +02:00
3dfb07e875 fix(core): update 2022-08-02 14:50:18 +02:00
fde1e90440 5.0.1 2022-07-28 10:10:40 +02:00
f06c9f186f fix(core): update 2022-07-28 10:10:39 +02:00
e539489901 5.0.0 2022-07-28 10:09:35 +02:00
a1dcfba0a2 BREAKING CHANGE(core): switch to esm 2022-07-28 10:09:34 +02:00
cff79e56c0 4.0.11 2022-07-28 10:09:01 +02:00
44252ab0d3 fix(core): update 2022-07-28 10:09:01 +02:00
d4c3ec6c90 4.0.10 2020-06-08 19:03:18 +00:00
42aa1c2831 fix(core): update 2020-06-08 19:03:17 +00:00
adf602ab86 4.0.9 2020-06-08 18:58:56 +00:00
8bc8285430 fix(core): update 2020-06-08 18:58:55 +00:00
63d9434a39 4.0.8 2020-06-08 18:58:44 +00:00
32ddc9cfed fix(core): update 2020-06-08 18:58:43 +00:00
936a719682 4.0.7 2020-06-08 18:57:23 +00:00
56c4b43f3c fix(core): update 2020-06-08 18:57:22 +00:00
5ed11a280f 4.0.6 2019-10-01 12:32:40 +02:00
346809d5be fix(core): update 2019-10-01 12:32:39 +02:00
90add506e3 4.0.5 2019-09-13 11:20:48 +02:00
adea8d1d69 fix(core): update 2019-09-13 11:20:47 +02:00
15 changed files with 13879 additions and 1107 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -3,75 +3,82 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
mirror: auditProductionDependencies:
stage: security image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk - npmci command npm install --production --ignore-scripts
- npmci command npm install --ignore-scripts - npmci command npm config set registry https://registry.npmjs.org
- npmci command snyk test - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
- notpriv allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ==================== # ====================
# test stage # test stage
# ==================== # ====================
testLTS: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# metadata stage # metadata stage
@ -79,35 +86,37 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- docker - lossless
- priv - docker
- priv
trigger: trigger:
stage: metadata stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci command npm install -g @gitzone/tsdoc - npmci node install stable
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command npm run buildDocs
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:
@ -115,5 +124,5 @@ pages:
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true allow_failure: true

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,43 +0,0 @@
# @pushrocks/qenv
easy promised environments
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/qenv)
* [gitlab.com (source)](https://gitlab.com/pushrocks/qenv)
* [github.com (source mirror)](https://github.com/pushrocks/qenv)
* [docs (typedoc)](https://pushrocks.gitlab.io/qenv/)
## Status for master
[![build status](https://gitlab.com/pushrocks/qenv/badges/master/build.svg)](https://gitlab.com/pushrocks/qenv/commits/master)
[![coverage report](https://gitlab.com/pushrocks/qenv/badges/master/coverage.svg)](https://gitlab.com/pushrocks/qenv/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/qenv.svg)](https://www.npmjs.com/package/@pushrocks/qenv)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/qenv/badge.svg)](https://snyk.io/test/npm/@pushrocks/qenv)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Use TypeScript for best in class instellisense.
qenv works with two files:
- **qenv.yml** - specifies which ENV vars are required.
- **env.yml** - specifies all env vars that are not already set in the current environment.
Now obviously you can set build specific env vars in many CI environments.
So there we do not need an **env.yml** since all ENV vars are in place
However when on another machine you can have a env.yml that will be added to the environment by qenv.
```javascript
import { Qenv } from 'qenv';
const myQenv = new Qenv('path/to/dir/where/qenv.yml/is/', 'path/to/dir/where/env.yml/is(');
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

View File

@ -4,11 +4,12 @@
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",
"gitrepo": "qenv", "gitrepo": "qenv",
"shortDescription": "easy promised environments", "description": "easy promised environments",
"npmPackagename": "@pushrocks/qenv", "npmPackagename": "@pushrocks/qenv",
"license": "MIT" "license": "MIT"
} }

14515
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,15 @@
{ {
"name": "@pushrocks/qenv", "name": "@pushrocks/qenv",
"version": "4.0.4", "version": "5.0.2",
"private": false, "private": false,
"description": "easy promised environments", "description": "easy promised environments",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)" "build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -25,27 +27,30 @@
}, },
"homepage": "https://gitlab.com/pushrocks/qenv#README", "homepage": "https://gitlab.com/pushrocks/qenv#README",
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@gitzone/tsbuild": "^2.1.63",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.37",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.72",
"@pushrocks/tapbundle": "^3.0.13", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^12.7.2", "@types/node": "^18.6.3"
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^7.0.4", "@pushrocks/smartfile": "^10.0.4",
"@pushrocks/smartlog": "^2.0.19" "@pushrocks/smartlog": "^3.0.1",
"@pushrocks/smartpath": "^5.0.5"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_*/**/*",
"dist_ts_web/*", "dist_ts/**/*",
"assets/*", "dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

54
readme.md Normal file
View File

@ -0,0 +1,54 @@
# @pushrocks/qenv
easy promised environments
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/qenv)
* [gitlab.com (source)](https://gitlab.com/pushrocks/qenv)
* [github.com (source mirror)](https://github.com/pushrocks/qenv)
* [docs (typedoc)](https://pushrocks.gitlab.io/qenv/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/qenv/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/qenv/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/qenv)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/qenv)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/qenv)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/qenv)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/qenv)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
qenv works with two files:
- **qenv.yml** - specifies which ENV vars are required.
- **env.yml** - specifies all env vars that are not already set in the current environment.
Now obviously you can set build specific env vars in many CI environments.
So there we do not need an **env.yml** since all ENV vars are in place
However when on another machine you can have a env.yml that will be added to the environment by qenv.
```javascript
import { Qenv } from 'qenv';
const myQenv = new Qenv('path/to/dir/where/qenv.yml/is/', 'path/to/dir/where/env.yml/is(');
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,29 +1,35 @@
import * as path from 'path'; import * as path from 'path';
import { tap, expect } from '@pushrocks/tapbundle'; import { tap, expect } from '@pushrocks/tapbundle';
import * as qenv from '../ts/index'; import * as qenv from '../ts/index.js';
import * as smartpath from '@pushrocks/smartpath';
export { smartpath };
const testDir = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
process.env['key1'] = 'original'; process.env['key1'] = 'original';
let testQenv: qenv.Qenv; let testQenv: qenv.Qenv;
tap.test('should create a new class', async () => { tap.test('should create a new class', async () => {
testQenv = new qenv.Qenv(path.join(__dirname, 'assets'), path.join(__dirname, 'assets'), false); testQenv = new qenv.Qenv(path.join(testDir, 'assets'), path.join(testDir, 'assets'), false);
expect(testQenv).to.be.instanceof(qenv.Qenv); expect(testQenv).toBeInstanceOf(qenv.Qenv);
}); });
tap.test('key1 should be not be overwritten since it is already present', async () => { tap.test('key1 should be not be overwritten since it is already present', async () => {
expect(testQenv.getEnvVarRequired('key1')).to.equal('original'); expect(testQenv.getEnvVarRequired('key1')).toEqual('original');
expect(testQenv.getEnvVarOnDemand('key1')).to.equal('original'); expect(testQenv.getEnvVarOnDemand('key1')).toEqual('original');
}); });
tap.test('key2 should be read from Yml', async () => { tap.test('key2 should be read from Yml', async () => {
expect(testQenv.getEnvVarRequired('key2')).to.equal('fromJson'); expect(testQenv.getEnvVarRequired('key2')).toEqual('fromJson');
expect(testQenv.getEnvVarOnDemand('key2')).to.equal('fromJson'); expect(testQenv.getEnvVarOnDemand('key2')).toEqual('fromJson');
}); });
tap.test('keyValueObjectArray should hold all retrieved values', async () => { tap.test('keyValueObjectArray should hold all retrieved values', async () => {
expect(testQenv.keyValueObject.key1).to.equal('original'); expect(testQenv.keyValueObject.key1).toEqual('original');
expect(testQenv.keyValueObject.key2).to.equal('fromJson'); expect(testQenv.keyValueObject.key2).toEqual('fromJson');
}); });
tap.start(); tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/qenv',
version: '5.0.2',
description: 'easy promised environments'
}

View File

@ -1 +1 @@
export * from './qenv.classes.qenv'; export * from './qenv.classes.qenv.js';

View File

@ -1,5 +1,4 @@
import * as plugins from './qenv.plugins'; import * as plugins from './qenv.plugins.js';
plugins.smartlog.defaultLogger.enableConsole();
/** /**
* class Qenv * class Qenv
@ -10,20 +9,13 @@ export class Qenv {
public availableEnvVars: string[] = []; public availableEnvVars: string[] = [];
public missingEnvVars: string[] = []; public missingEnvVars: string[] = [];
public keyValueObject: { [key: string]: any } = {}; public keyValueObject: { [key: string]: any } = {};
public logger: plugins.smartlog.Smartlog; public logger = new plugins.smartlog.ConsoleLog();
// filePaths // filePaths
public qenvFilePathAbsolute: string; public qenvFilePathAbsolute: string;
public envFilePathAbsolute: string; public envFilePathAbsolute: string;
constructor( constructor(qenvFileBasePathArg = process.cwd(), envFileBasePathArg, failOnMissing = true) {
qenvFileBasePathArg = process.cwd(),
envFileBasePathArg,
failOnMissing = true,
loggerArg: plugins.smartlog.Smartlog = plugins.smartlog.defaultLogger
) {
this.logger = loggerArg;
// lets make sure paths are absolute // lets make sure paths are absolute
this.qenvFilePathAbsolute = plugins.path.join( this.qenvFilePathAbsolute = plugins.path.join(
plugins.path.resolve(qenvFileBasePathArg), plugins.path.resolve(qenvFileBasePathArg),
@ -64,40 +56,39 @@ export class Qenv {
/** /**
* tries to get any env var even if it is not required * tries to get any env var even if it is not required
* @param requiredEnvVar * @param wantedEnvVar
*/ */
public getEnvVarOnDemand(requiredEnvVar: string): string { public getEnvVarOnDemand(wantedEnvVar: string): string {
// lets determine the actual env yml let envVarFromEnvironmentVariable: string;
let envYml; let envVarFromEnvJsonFile: string;
try { let envVarFromDockerSecret: string;
envYml = plugins.smartfile.fs.toObjectSync(this.envFilePathAbsolute);
} catch (err) {
envYml = {};
}
let envVar: string;
let envFileVar: string;
let dockerSecret: string;
let dockerSecretJson: string; let dockerSecretJson: string;
// env var check // env var check
if (process.env[requiredEnvVar]) { if (process.env[wantedEnvVar]) {
this.availableEnvVars.push(requiredEnvVar); this.availableEnvVars.push(wantedEnvVar);
envVar = process.env[requiredEnvVar]; envVarFromEnvironmentVariable = process.env[wantedEnvVar];
} }
// env file check // env file check
if (envYml.hasOwnProperty(requiredEnvVar)) { // lets determine the actual env yml
envFileVar = envYml[requiredEnvVar]; let envJsonFileAsObject;
this.availableEnvVars.push(requiredEnvVar); try {
envJsonFileAsObject = plugins.smartfile.fs.toObjectSync(this.envFilePathAbsolute);
} catch (err) {
envJsonFileAsObject = {};
}
if (envJsonFileAsObject.hasOwnProperty(wantedEnvVar)) {
envVarFromEnvJsonFile = envJsonFileAsObject[wantedEnvVar];
} }
// docker secret check // docker secret check
if ( if (
plugins.smartfile.fs.isDirectory('/run') && plugins.smartfile.fs.isDirectory('/run') &&
plugins.smartfile.fs.isDirectory('/run/secrets') && plugins.smartfile.fs.isDirectory('/run/secrets') &&
plugins.smartfile.fs.fileExistsSync(`/run/secrets/${requiredEnvVar}`) plugins.smartfile.fs.fileExistsSync(`/run/secrets/${wantedEnvVar}`)
) { ) {
dockerSecret = plugins.smartfile.fs.toStringSync(`/run/secrets/${requiredEnvVar}`); envVarFromDockerSecret = plugins.smartfile.fs.toStringSync(`/run/secrets/${wantedEnvVar}`);
} }
// docker secret.json // docker secret.json
@ -107,42 +98,53 @@ export class Qenv {
) { ) {
const availableSecrets = plugins.smartfile.fs.listAllItemsSync('/run/secrets'); const availableSecrets = plugins.smartfile.fs.listAllItemsSync('/run/secrets');
for (const secret of availableSecrets) { for (const secret of availableSecrets) {
if (secret.includes('secret.json') && !dockerSecret) { if (secret.includes('secret.json') && !envVarFromDockerSecret) {
const secretObject = plugins.smartfile.fs.toObjectSync(`/run/secrets/${secret}`); const secretObject = plugins.smartfile.fs.toObjectSync(`/run/secrets/${secret}`);
dockerSecret = secretObject[requiredEnvVar]; envVarFromDockerSecret = secretObject[wantedEnvVar];
} }
} }
} }
// warn if there is more than one candidate // warn if there is more than one candidate
let candidatesCounter = 0; const availableCcandidates: any[] = [];
[envVar, envFileVar, dockerSecret, dockerSecretJson].forEach(candidate => { [
envVarFromEnvironmentVariable,
envVarFromEnvJsonFile,
envVarFromDockerSecret,
dockerSecretJson,
].forEach((candidate) => {
if (candidate) { if (candidate) {
candidatesCounter++; availableCcandidates.push(candidate);
} }
}); });
if (candidatesCounter > 1) { if (availableCcandidates.length > 1) {
this.logger.log( this.logger.log(
'warn', 'warn',
`found multiple candidates for ${requiredEnvVar} Choosing in the order of envVar, envFileVar, dockerSecret, dockerSecretJson` `found multiple candidates for ${wantedEnvVar} Choosing in the order of envVar, envFileVar, dockerSecret, dockerSecretJson`
); );
console.log(availableCcandidates);
} }
let chosenVar: string = null; switch (true) {
if (envVar) { case !!envVarFromEnvironmentVariable:
this.logger.log('ok', `found ${requiredEnvVar} as environment variable`); this.logger.log('ok', `found ${wantedEnvVar} as environment variable`);
chosenVar = envVar; return envVarFromEnvironmentVariable;
} else if (envFileVar) { case !!envVarFromEnvJsonFile:
this.logger.log('ok', `found ${requiredEnvVar} as env.json variable`); this.logger.log('ok', `found ${wantedEnvVar} as env.json variable`);
chosenVar = envFileVar; return envVarFromEnvJsonFile;
} else if (dockerSecret) { case !!envVarFromDockerSecret:
this.logger.log('ok', `found ${requiredEnvVar} as docker secret`); this.logger.log('ok', `found ${wantedEnvVar} as docker secret`);
chosenVar = dockerSecret; return envVarFromDockerSecret;
} else if (dockerSecretJson) { case !!dockerSecretJson:
this.logger.log('ok', `found ${requiredEnvVar} as docker secret.json`); this.logger.log('ok', `found ${wantedEnvVar} as docker secret.json`);
chosenVar = dockerSecretJson; return dockerSecretJson;
default:
this.logger.log(
'warn',
`could not find the wanted environment variable ${wantedEnvVar} anywhere`
);
return;
} }
return chosenVar;
} }
/** /**
@ -154,13 +156,16 @@ export class Qenv {
qenvFile = plugins.smartfile.fs.toObjectSync(this.qenvFilePathAbsolute); qenvFile = plugins.smartfile.fs.toObjectSync(this.qenvFilePathAbsolute);
} }
if (!qenvFile || !qenvFile.required || !Array.isArray(qenvFile.required)) { if (!qenvFile || !qenvFile.required || !Array.isArray(qenvFile.required)) {
this.logger.log('warn', `qenv (promised environment): ./env.yml File does not contain a 'required' Array!`); this.logger.log(
'warn',
`qenv (promised environment): ./qenv.yml File does not contain a 'required' Array! This might be ok though.`
);
} else { } else {
for (const keyArg of Object.keys(qenvFile.required)) { for (const keyArg of Object.keys(qenvFile.required)) {
this.requiredEnvVars.push(qenvFile.required[keyArg]); this.requiredEnvVars.push(qenvFile.required[keyArg]);
} }
} }
} };
/** /**
* gets the available env vars * gets the available env vars

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}