Skip to content

Allow environment overrides for all config knobs

Warren Gifford requested to merge github/fork/mdaniel/config-via-env into master

Created by: mdaniel

Including, naturally, the config location itself. This takes the opportunity to pull some magic strings up into constants to make their usage more obvious

This commit stops shy of wrapping the 132 character long help text line, because maybe that's the golang way, but it could arguably be improved, also

--- PASS: TestReadConfig (0.01s)
    --- PASS: TestReadConfig/pure_defaults (0.00s)
    --- PASS: TestReadConfig/accessToken_in_the_environment (0.00s)
    --- PASS: TestReadConfig/accessToken_in_the_-config_flag (0.00s)
    --- PASS: TestReadConfig/accessToken_in_a_file_identified_by_the_SRC_CONFIG_env (0.00s)
    --- PASS: TestReadConfig/accessToken_in_the_env,_superseding_-config_file (0.00s)
    --- PASS: TestReadConfig/accessToken_in_the_env,_superseding_SRC_CONFIG_file (0.00s)
    --- PASS: TestReadConfig/accessToken_in_the_env,_superseding_-config,_with_SRC_CONFIG_set (0.00s)
    --- PASS: TestReadConfig/accessToken_in_-config,_with_SRC_CONFIG_set (0.00s)
    --- PASS: TestReadConfig/endpoint_in_SRC_ENDPOINT (0.00s)
    --- PASS: TestReadConfig/endpoint_in_SRC_ENDPOINT,_superseding_-config (0.00s)
    --- PASS: TestReadConfig/endpoint_in_SRC_ENDPOINT,_and_-config,_-endpoint_wins (0.00s)
    --- PASS: TestReadConfig/endpoint_in_-config,_but_-endpoint_wins (0.00s)
    --- PASS: TestReadConfig/ensure_env-vars_do_not_leak (0.00s)

cc: @sqs as mentioned in the other thread cc: @nicksnyder per our discussion over email (I am expecting there is more coming, but this certainly is something to discuss)

Merge request reports

Loading