Reads a config.exs from the data dir when a release boots.
The file lets you configure a beamlet without rebuilding it. It is a plain Elixir config file:
import Config
config :beamlet,
policies: [
explorer: [tools: [:eval]]
],
eval: [timeout: 60_000]It can set any of the keys Beamlet.Config lists. It is read after
all other config, so what it says wins.
A policy here replaces the policy whole
When the file names a policy, its version replaces any policy of the same name declared elsewhere. The two are not merged. Policies the file does not name are kept.
A change takes a restart. beamlet policies.show reads the file
afresh each time it runs, so you can check a change first. A
beamlet with no file starts as usual. A file that fails to
evaluate stops the boot with the file and line at fault.
The file stands alone: import_config and config_env/0 do not
work in it.
In your own release
The standalone server reads the file already. To read it in your
own release, add the provider to its config_providers:
releases: [
my_app: [
config_providers: [
{Beamlet.Config.Provider, path: {:system, "BEAMLET_DATA_DIR", "/config.exs"}}
]
]
]path takes any path Config.Provider accepts. Point it at the
same directory as :data_dir.
Summary
Functions
Reads the file, returning what it declares.
Functions
Reads the file, returning what it declares.
Raises ArgumentError naming the file, and the line when the error
has one in it, so a boot log says where to look.