diff --git a/.drone-home.jsonnet b/.drone-home.jsonnet index a72f59f..cbae5a3 100644 --- a/.drone-home.jsonnet +++ b/.drone-home.jsonnet @@ -2,33 +2,42 @@ local util = { fromSecret(secret): { from_secret: secret, }, + secret(secret): std.asciiLower( + std.strReplace( + secret, + '_', + '-', + ), + ), + environment(secret): std.asciiUpper( + std.strReplace( + secret, + '-', + '_', + ), + ), + env(secret): std.asciiLower( + std.strReplace( + secret, + '-', + '_', + ), + ), printEnv(file, env): function(step) step { environment +: { - [std.asciiHigher(env)]: util.fromSecret( - std.asciiLower( - std.strReplace( - env, - '_', - '-', - ), - ), + [util.environment(env)]: util.fromSecret( + util.secret(env) ), }, settings +: { envs +: [ - std.asciiLower(env), + util.env(env), ], script +: [ 'echo "export %(environment)=\'$${%(environment)s}\'" >> %(file) # %(secret)s' % { - environment: std.asciiHigher(env), + environment: util.environment(env), file: file, - secret: std.asciiLower( - std.strReplace( - env, - '_', - '-', - ), - ), + secret: util.secret(env), }, ], },