mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 20:16:54 +01:00
handle missing secrets
Missing secrets will give a blank string instead of exploding. Also, an example of a custom property
This commit is contained in:
parent
d3dd7498e6
commit
544daf5756
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user