@certik/skynet 0.10.54 → 0.10.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.56
4
+
5
+ - Fixed: should await on app deploy check
6
+
7
+ ## 0.10.55
8
+
9
+ - Fixed: local nomad deployment error for multiple line string secret
10
+
3
11
  ## 0.10.54
4
12
 
5
13
  - Supported await on return value from `app()`
package/app.js CHANGED
@@ -29,22 +29,26 @@ function isDeleteCommand(command) {
29
29
  }
30
30
 
31
31
  async function checkDeployEnv(env) {
32
- // check sensitive env
33
- const missingEnvs = [];
34
-
35
- for (let key of Object.keys(env)) {
36
- if (env[key] === SENSITIVE_VALUE) {
37
- const res = await fetch(`${SKYNET_API_PREFIX}/secrets/verify?name=${key}`);
38
-
39
- if (res.ok) {
40
- const hasEnv = await res.json();
41
-
42
- if (!hasEnv) {
43
- missingEnvs.push(key);
32
+ const envStatus = await Promise.all(
33
+ Object.keys(env).map(async (key) => {
34
+ if (env[key] === SENSITIVE_VALUE) {
35
+ // check sensitive env
36
+ const res = await fetch(`${SKYNET_API_PREFIX}/secrets/verify?name=${key}`);
37
+
38
+ if (res.ok) {
39
+ const hasEnv = await res.json();
40
+
41
+ if (!hasEnv) {
42
+ return { name: key, ok: false };
43
+ }
44
44
  }
45
45
  }
46
- }
47
- }
46
+
47
+ return { name: key, ok: true };
48
+ })
49
+ );
50
+
51
+ const missingEnvs = envStatus.filter((s) => !s.ok).map((s) => s.name);
48
52
 
49
53
  if (missingEnvs.length > 0) {
50
54
  console.log(`Missing the following sensitive environment on nomad server:${EOL}- ${missingEnvs.join(EOL + "- ")}`);
@@ -94,7 +98,7 @@ function createApp({ parameterErrors, env, check, onRun, onDeploy, onCheck }) {
94
98
  }
95
99
 
96
100
  if (process.argv.includes("--production")) {
97
- checkDeployEnv(env)
101
+ await checkDeployEnv(env)
98
102
  .then(() => onDeploy())
99
103
  .catch(console.error);
100
104
  } else {
package/deploy.js CHANGED
@@ -39,7 +39,7 @@ function getEnvironmentVariableValue(name, isProduction) {
39
39
  return `""`;
40
40
  }
41
41
 
42
- return `"${process.env[name]}"`;
42
+ return `"${process.env[name]}"`.replaceAll("\n", "\\n");
43
43
  }
44
44
  }
45
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.10.54",
3
+ "version": "0.10.56",
4
4
  "description": "Skynet Shared JS library",
5
5
  "main": "index.js",
6
6
  "author": "CertiK Engineering",