diff --git a/Shared/Secrets.swift.gyb b/Shared/Secrets.swift.gyb index 8157424a2..b20e8bf56 100644 --- a/Shared/Secrets.swift.gyb +++ b/Shared/Secrets.swift.gyb @@ -18,11 +18,11 @@ def snake_to_camel(snake_str): salt = [ord(byte) for byte in os.urandom(64)] }% enum Secrets { - % for secret in secrets: + static var ${snake_to_camel(secret)}: String { let encoded: [UInt8] = [ - % for chunk in chunks(encode(os.environ.get(secret), salt), 8): + % for chunk in chunks(encode(os.environ.get(secret) or "", salt), 8): ${"".join(["0x%02x, " % byte for byte in chunk])} % end ] @@ -30,7 +30,10 @@ enum Secrets { return decode(encoded, salt: salt) } % end - + + %{ + # custom example: static let myVariable = "${os.environ.get('MY_CUSTOM_VARIABLE')}" + }% } private extension Secrets {