X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fconfig%2Fholder.ex;h=f037d5d483b2298e1b92c4b02ed5fcc056806af9;hb=7f83b35a9dea7181b57d9b975742233813fa3a8b;hp=d4fe892af73c36becca3658d27149574d1384b8d;hpb=2cfe1b93854c117fda19e54ea17c99f72413a569;p=akkoma
diff --git a/lib/pleroma/config/holder.ex b/lib/pleroma/config/holder.ex
index d4fe892af..f037d5d48 100644
--- a/lib/pleroma/config/holder.ex
+++ b/lib/pleroma/config/holder.ex
@@ -1,16 +1,35 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Config.Holder do
- @config Pleroma.Config.Loader.load_and_merge()
+ @config Pleroma.Config.Loader.default_config()
- @spec config() :: keyword()
- def config, do: @config
+ @spec save_default() :: :ok
+ def save_default do
+ default_config =
+ if System.get_env("RELEASE_NAME") do
+ release_config =
+ [:code.root_dir(), "releases", System.get_env("RELEASE_VSN"), "releases.exs"]
+ |> Path.join()
+ |> Pleroma.Config.Loader.read()
- @spec config(atom()) :: any()
- def config(group), do: @config[group]
+ Pleroma.Config.Loader.merge(@config, release_config)
+ else
+ @config
+ end
- @spec config(atom(), atom()) :: any()
- def config(group, key), do: @config[group][key]
+ Pleroma.Config.put(:default_config, default_config)
+ end
+
+ @spec default_config() :: keyword()
+ def default_config, do: get_default()
+
+ @spec default_config(atom()) :: keyword()
+ def default_config(group), do: Keyword.get(get_default(), group)
+
+ @spec default_config(atom(), atom()) :: keyword()
+ def default_config(group, key), do: get_in(get_default(), [group, key])
+
+ defp get_default, do: Pleroma.Config.get(:default_config)
end