1 defmodule Pleroma.Config.ReleaseRuntimeProvider do
3 Imports runtime config and `{env}.exported_from_db.secret.exs` for releases.
5 @behaviour Config.Provider
8 def init(opts), do: opts
11 def load(config, opts) do
12 with_defaults = Config.Reader.merge(config, Pleroma.Config.Holder.release_defaults())
16 opts[:config_path] -> opts[:config_path]
17 System.get_env("PLEROMA_CONFIG_PATH") -> System.get_env("PLEROMA_CONFIG_PATH")
18 System.get_env("AKKOMA_CONFIG_PATH") -> System.get_env("AKKOMA_CONFIG_PATH")
19 File.exists?("/etc/akkoma/config.exs") -> "/etc/akkoma/config.exs"
20 true -> "/etc/pleroma/config.exs"
24 if File.exists?(config_path) do
25 runtime_config = Config.Reader.read!(config_path)
28 |> Config.Reader.merge(pleroma: [config_path: config_path])
29 |> Config.Reader.merge(runtime_config)
34 "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file",
42 exported_config_path =
43 opts[:exported_config_path] ||
46 |> Path.join("#{Pleroma.Config.get(:env)}.exported_from_db.secret.exs")
49 if File.exists?(exported_config_path) do
50 exported_config = Config.Reader.read!(exported_config_path)
51 Config.Reader.merge(with_runtime_config, exported_config)