69 lines
1.2 KiB
Plaintext
69 lines
1.2 KiB
Plaintext
{
|
|
// make secret format
|
|
secret(secret): std.asciiLower(
|
|
std.strReplace(
|
|
secret,
|
|
'_',
|
|
'-',
|
|
),
|
|
),
|
|
// make environment format
|
|
environment(secret): std.asciiUpper(
|
|
std.strReplace(
|
|
secret,
|
|
'-',
|
|
'_',
|
|
),
|
|
),
|
|
// make env format
|
|
env(secret): std.asciiLower(
|
|
std.strReplace(
|
|
secret,
|
|
'-',
|
|
'_',
|
|
),
|
|
),
|
|
// environment from secret
|
|
fromSecret(name): {
|
|
from_secret: name,
|
|
},
|
|
// set an environment and an env for ssh
|
|
envSet(env): function(step) step {
|
|
environment +: {
|
|
[$.environment(env)]: $.fromSecret(
|
|
$.secret(env)
|
|
),
|
|
},
|
|
settings +: {
|
|
envs +: [
|
|
$.env(env),
|
|
],
|
|
},
|
|
},
|
|
// set an environment to a value
|
|
envValue(env, value): function(step) step {
|
|
environment +: {
|
|
[$.environment(env)]: value,
|
|
},
|
|
settings +: {
|
|
envs +: [
|
|
$.env(env),
|
|
],
|
|
},
|
|
},
|
|
// makes environment variables and corresponding secrets
|
|
environmentSecrets(vars):
|
|
std.foldl(
|
|
function(obj, value)
|
|
obj {
|
|
[$.environment(value)]: $.fromSecret(
|
|
$.secret(
|
|
value,
|
|
),
|
|
),
|
|
},
|
|
vars,
|
|
{},
|
|
),
|
|
}
|