Gah, I just realized it doesn’t matter. ci.exs can just overwrite whatever it wants, and it doesn’t need to read existing values to do so. Not sure even sure what I was thinking in the first place.
Still, I’m curious why Application.get_env doesn’t get things immediately written by config/3.
defmodule Config do
defp put_config(value), do: Process.put(@config_key, value)
def config(root_key, opts) when is_atom(root_key) and is_list(opts) do
unless Keyword.keyword?(opts) do
raise ArgumentError, "config/2 expected a keyword list, got: #{inspect(opts)}"
end
get_config!()
|> __merge__([{root_key, opts}])
|> put_config()
end
end
So you can access it with Process.get({Config, :config}), but I’d suggest not to do this.