Skip to content

Commit 9515c03

Browse files
authoredFeb 5, 2022
3.3.0 (#194)
* feature: env file load * build: 3.3.0
1 parent 80624d8 commit 9515c03

9 files changed

+569
-497
lines changed
 

‎CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
# Runnerty ChangeLog
22

3+
<a name="3.3.0"></a>
4+
5+
# [3.3.0](5/2/2022)
6+
7+
### Features
8+
9+
- **common:** by default the environment variables will be read from the `.env` file in the root directory if it exists or from the file specified by cli in env-file
10+
- **cli:** new option --env-file, for reading environment variables from the path of the specified file
11+
- **interpreter:** new @GENV and @ENV functions for reading environment variables
12+
313
<a name="3.2.7"></a>
414

515
# [3.2.7](3/2/2022)
16+
617
### Bug Fixes
718

819
- **common:** fixed empty values comparison in process dependencies (depends_process)
920

1021
<a name="3.2.6"></a>
1122

1223
# [3.2.6](31/12/2021)
24+
1325
### Features
1426

1527
- **dependencies:** minor dependency updates

‎__tests__/end2end.spec.js

+24
Original file line numberDiff line numberDiff line change
@@ -868,3 +868,27 @@ describe('TestDefaultsConfigIterableChain', () => {
868868
);
869869
});
870870
});
871+
872+
describe('ENVFunction', () => {
873+
const successOutput = `info: res CONFIG_vtest vtest`;
874+
test('Execution End2End: ENVFunction', done => {
875+
exec(
876+
'env_test=vtest node',
877+
[
878+
'index.js',
879+
'-c',
880+
'./__tests__/end2end/config.json',
881+
'-p',
882+
'./__tests__/end2end/plan_env.json',
883+
'-f',
884+
'CHAIN_ONE',
885+
'--end'
886+
],
887+
3000,
888+
res => {
889+
expect(flatOutput(res)).toEqual(flatSuccessOutput(successOutput));
890+
done();
891+
}
892+
);
893+
});
894+
});

‎__tests__/end2end/config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"global_values": [
5151
{
5252
"myparams": {
53-
"sample": "sample_value"
53+
"sample": "sample_value",
54+
"env_test": "CONFIG_@ENV(env_test)"
5455
}
5556
}
5657
]

‎__tests__/end2end/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "0.0.1",
44
"private": false,
55
"dependencies": {
6-
"@runnerty/executor-shell": "^3.1.4",
7-
"@runnerty/executor-wait": "^3.0.7",
8-
"@runnerty/executor-iterable": "^3.1.2",
9-
"@runnerty/notifier-console": "^3.0.6",
10-
"@runnerty/trigger-schedule": "^3.0.6",
11-
"@runnerty/trigger-immediate": "^3.0.7"
6+
"@runnerty/executor-shell": "^3.2.0",
7+
"@runnerty/executor-wait": "^3.1.0",
8+
"@runnerty/executor-iterable": "^3.2.0",
9+
"@runnerty/notifier-console": "^3.1.0",
10+
"@runnerty/trigger-schedule": "^3.1.0",
11+
"@runnerty/trigger-immediate": "^3.1.0"
1212
}
1313
}

‎__tests__/end2end/plan_env.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/runnerty/schemas/master/schemas/3.2/plan.json",
3+
"chains": [
4+
{
5+
"id": "CHAIN_ONE",
6+
"name": "CHAIN_ONE",
7+
"processes": [
8+
{
9+
"id": "PROCESS_ONE",
10+
"name": "PROCESS_ONE",
11+
"exec": {
12+
"id": "shell_default",
13+
"command": "echo 'res @GV(myparams_env_test) @GENV(env_test)'"
14+
},
15+
"notifications": {
16+
"on_end": [
17+
{
18+
"id": "console_default",
19+
"message": "@GV(PROCESS_EXEC_MSG_OUTPUT)"
20+
}
21+
]
22+
}
23+
}
24+
]
25+
}
26+
]
27+
}

‎lib/app.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ async function initCli() {
2424

2525
async function main(cliCmd) {
2626
try {
27+
const dotenvOptions = {};
28+
if (cliCmd.envFile) dotenvOptions.path = cliCmd.envFile;
29+
require('dotenv').config(dotenvOptions);
2730
if (!cliCmd.mustContinue) process.exit();
2831
await init(cliCmd.configFilePath, cliCmd.options);
2932
utils.forceInitChainExecution(cliCmd.options);

‎lib/cli.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ class Cli {
9292
.option(
9393
'-en, --exclude_namespace <namespace>',
9494
'Disable the chains of the indicated namespace. It is possible to set a list of comma separated items'
95-
);
95+
)
96+
.option('--env-file <env_file_path>', 'Read in a file of environment variables', envFilePath => {
97+
this.envFile = envFilePath;
98+
});
9699

97100
// init project:
98101
program

‎package-lock.json

+476-475
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "runnerty",
33
"description": "Process orchestrator",
4-
"version": "3.2.7",
4+
"version": "3.3.0",
55
"preferGlobal": true,
66
"main": "index.js",
77
"license": "MIT",
@@ -26,25 +26,26 @@
2626
"lint": "eslint '**/*.js' && prettier --check '**'"
2727
},
2828
"dependencies": {
29-
"@runnerty/interpreter-core": "~3.0.3",
30-
"@runnerty/trigger-server": "~3.0.8",
31-
"ajv": "~8.8.2",
29+
"@runnerty/interpreter-core": "~3.1.0",
30+
"@runnerty/trigger-server": "~3.1.0",
31+
"ajv": "~8.10.0",
3232
"axios": "~0.25.0",
3333
"better-ajv-errors": "~1.1.2",
3434
"body-parser": "~1.19.1",
3535
"boxen": "~5.1.2",
3636
"bytes": "~3.1.1",
3737
"chalk": "~4.1.2",
38-
"colors": "^1.4.0",
39-
"commander": "~8.3.0",
38+
"colors": "1.4.0",
39+
"commander": "~9.0.0",
4040
"cors": "~2.8.5",
4141
"cron-parser": "~4.2.1",
42+
"dotenv": "^16.0.0",
4243
"express": "~4.17.2",
4344
"express-basic-auth": "~1.2.1",
4445
"express-jwt": "~6.1.0",
4546
"fs-extra": "~10.0.0",
4647
"glob-to-regexp": "~0.4.1",
47-
"helmet": "~4.6.0",
48+
"helmet": "~5.0.2",
4849
"json-stringify-safe": "~5.0.1",
4950
"jsonfile": "^6.1.0",
5051
"jsonwebtoken": "~8.5.1",
@@ -60,7 +61,7 @@
6061
"semver": "~7.3.5",
6162
"socket.io-client": "~4.4.1",
6263
"update-notifier": "~5.1.0",
63-
"winston": "~3.4.0"
64+
"winston": "~3.5.1"
6465
},
6566
"keywords": [
6667
"runnerty",
@@ -94,14 +95,14 @@
9495
"node": ">=14.0.0"
9596
},
9697
"devDependencies": {
97-
"@babel/core": "^7.16.7",
98-
"@babel/eslint-parser": "^7.16.5",
99-
"eslint": "^8.7.0",
98+
"@babel/core": "^7.17.0",
99+
"@babel/eslint-parser": "^7.17.0",
100+
"eslint": "^8.8.0",
100101
"eslint-config-prettier": "^8.3.0",
101-
"eslint-plugin-jest": "^25.7.0",
102+
"eslint-plugin-jest": "^26.0.0",
102103
"eslint-plugin-prettier": "^4.0.0",
103-
"jest": "^27.4.7",
104-
"jest-cli": "^27.4.7",
104+
"jest": "^27.5.0",
105+
"jest-cli": "^27.5.0",
105106
"prettier": "^2.5.1",
106107
"runnerty-tests-modules": "file:__tests__/end2end"
107108
},

0 commit comments

Comments
 (0)
Please sign in to comment.