diff --git a/src/hb_http_server.erl b/src/hb_http_server.erl index dffc6da1a..e3a0d559e 100644 --- a/src/hb_http_server.erl +++ b/src/hb_http_server.erl @@ -36,6 +36,8 @@ start() -> hb_opts:default_message_with_env(), Loaded ), + %% Store config to be reused later + persistent_term:put(server_startup_config, MergedConfig), %% Apply store defaults before starting store StoreOpts = hb_opts:get(store, no_store, MergedConfig), StoreDefaults = hb_opts:get(store_defaults, #{}, MergedConfig), diff --git a/src/hb_opts.erl b/src/hb_opts.erl index 3ff351dc1..c84b36edd 100644 --- a/src/hb_opts.erl +++ b/src/hb_opts.erl @@ -480,7 +480,10 @@ normalize_default(Default) -> Default. %% @doc An abstraction for looking up configuration variables. In the future, %% this is the function that we will want to change to support a more dynamic %% configuration system. -config_lookup(Key, Default, _Opts) -> maps:get(Key, default_message(), Default). +config_lookup(Key, Default, _Opts) -> + DefaultConfig = persistent_term:get(server_startup_config, default_message()), + DefaultConfig2 = maps:merge(default_message(), DefaultConfig), + maps:get(Key, DefaultConfig2, Default). %% @doc Parse a `flat@1.0' encoded file into a map, matching the types of the %% keys to those in the default message.