Skip to content

Commit 9b72969

Browse files
committed
feat(config): merge optional /etc/hyper/config.exs at runtime
runtime.exs merges an optional operator config from /etc/hyper/config.exs (override path via HYPER_CONFIG) last, so its values win. Skipped under :test.
1 parent 32d84cc commit 9b72969

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

config/runtime.exs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,18 @@ if config_env() != :test do
3838
config :opentelemetry, traces_exporter: :none
3939
end
4040
end
41+
42+
# Operator overrides from a well-known location. An optional Elixir config file
43+
# at /etc/hyper/config.exs (override the path with HYPER_CONFIG) is merged in
44+
# last, so its values win over every default set above. An absent file is a
45+
# no-op -- the normal case in dev and CI. Skipped under :test so the suite never
46+
# reads host state.
47+
if config_env() != :test do
48+
hyper_config = System.get_env("HYPER_CONFIG") || "/etc/hyper/config.exs"
49+
50+
if File.exists?(hyper_config) do
51+
for {app, kw} <- Config.Reader.read!(hyper_config, env: config_env()) do
52+
config app, kw
53+
end
54+
end
55+
end

0 commit comments

Comments
 (0)