there is no way to distinguish optional and required config vars
there is no way to know what config vars could be set
there is no way to know what the values of those config vars should be
if incorrect config vars are passed in, braid happily accepts them and subtle issues happen later
Part 1:
have register-config-var! take a second parameter, which is a malli schema
ex. (base/register-config-var! :google-maps-api-key [:re #"some-regex-for-google-api-keys"])
(may need to have a 3rd arg for optional vs required)
when 'reading' the config values (currently, here), check the values against the registered schema
change all uses of register-config-var! throughout Braid to use the 2-arg form
Part 2:
provide a function in braid.dev.core to list the expected config
Below is some related code I pulled from another project:
braid.base.api/register-config-var!
allows modules to declare optional or required config vars (read from mount-args).https://github.com/braidchat/braid/blob/master/src/braid/base/api.cljc#L149
Ex.
braid.embeds-map
does:(base/register-config-var! :google-maps-api-key)
However:
Part 1:
register-config-var!
take a second parameter, which is a malli schema ex.(base/register-config-var! :google-maps-api-key [:re #"some-regex-for-google-api-keys"])
register-config-var!
throughout Braid to use the 2-arg formPart 2:
braid.dev.core
to list the expected configBelow is some related code I pulled from another project: