Aero config migration advice #184
jacobobryant
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In preparation for the upcoming v1.0.0 release which includes an optional-but-recommended migration to Aero for config, I'm going through the upgrade instructions on one of my apps and wanted to give some more tips about rewriting your config in the format that Aero wants. Here's what step 4 says:
Here's specifically what I did. The process was fairly mechanical:
config.env
.secrets.env
toconfig.env
. (I also removed theexport
s, but it's fine if you leave them in.) Sort the lines (I used vim's:sort
command), then remove duplicates.resources/config.edn
.config.edn
file and copy everything from the:prod
section intoresources/config.edn
. For any keys that referenced values insecrets.env
, add a#biff/secret
. For example, I changed:mailgun/api-key "MAILGUN_API_KEY"
to:mailgun/api-key #biff/secret MAILGUN_API_KEY
.:dev
section intoresources/config.edn
. Add#biff/secret
where needed. Any keys that start with:biff
you can probably remove, since the defaultresources/config.edn
file comes with various Biff config keys already set.:dev
section with a#profile {:dev ...}
. For example, in my config I changed:com.yakread/disable-email-task true
to:com.yakread/disable-email-task #profile {:dev true}
.:dev
section, check to see if it was also in the:prod
section. If so, merge the two keys with#profile
, for example::stripe/api-key #profile {:prod #biff/secret STRIPE_SECRET_KEY :dev #biff/secret STRIPE_TEST_SECRET_KEY}
.You probably don't need to migrate anything over from the
:tasks
section unless you defined some custom tasks that used custom config.Going forward, the choice of whether to store a particular piece of config in
resources/config.edn
orconfig.env
is up to you/your situation. Secrets should always be stored inconfig.env
, but for everything else, you can default to putting it inresources/config.edn
and then only move it toconfig.env
if there's a need. For example, if you're developing an open-source app, you can put things inconfig.env
so that other people can supply their own config values.If you want to supply a default value in
resources/config.edn
but allow it to be overridden viaconfig.env
/an environment variable, you can do e.g.:foo/some-config-key #or [#biff/env FOO_SOME_CONFIG_KEY, "abc123"]
.If you have any questions about migrating, feel free to ask here.
Beta Was this translation helpful? Give feedback.
All reactions