@certik/skynet 0.10.55 → 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 +4 -0
- package/app.js +19 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/app.js
CHANGED
|
@@ -29,22 +29,26 @@ function isDeleteCommand(command) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async function checkDeployEnv(env) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 {
|