-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load secrets from files #10
Conversation
mdemare
commented
Sep 13, 2024
- Added support for ALLOWED_CLIENT_IDS
- Review feedback
- Support for loading secrets from files specified by env vars.
b6cfb6c
to
b1070c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dit is rommellig. Je bent eerst aan het valideren, dan dingen ongedaan aan het maken/parsen, en dan weer opnieuw valideren. Lees die secrets eerst, en valideer daarna:
(defn- load-secret-from-file
[env k]
(let [file-key (keyword (str (name k) "-file"))
file-name (env file-key)]
(if file-name
(assoc env k (str/trim (slurp file-name)))
env)))
(defn- env-with-secrets
"Environment map, with additional secrets loaded from files.
If a key \"K\" in `opt-specs` is not present, and a key \"K-file\"
is present, load the secret from that file and put it in the env map
under K."
[]
(->> opt-specs
keys
(reduce (fn [env k]
(if (contains? env k)
env
(load-secret-from-file env k)))
env)))
en dan verderop in main:
(let [[config errs] (envopts/opts (env-with-secrets) opt-specs)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
graag aanpassen
In jouw voorstel gooi je de validatie weg, dwz ofwel In principe kan Remco Jak testen met de b1070c6 commit, heb de laatste commit nog niet goed kunnen testen. |
6c73da5
to
f4e4efe
Compare
762419d
to
d5643c4
Compare
d5643c4
to
92c4e76
Compare