diff options
author | href <href@random.sh> | 2018-11-06 16:00:48 +0100 |
---|---|---|
committer | href <href@random.sh> | 2018-11-06 16:00:48 +0100 |
commit | 7d328c658da69ec236d10fa89d23f2a6886b3205 (patch) | |
tree | ef0f639fe4c57cf9160d0e69e2918461ecf9a008 /lib | |
parent | 36ca3c1b3ec814609d14815a672239a31b1e0ec5 (diff) | |
download | pleroma-7d328c658da69ec236d10fa89d23f2a6886b3205.tar.gz |
Small wrapper module around Application.get_env/put_env
Same API as the old Pleroma.Config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/config.ex | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex new file mode 100644 index 000000000..fc5338591 --- /dev/null +++ b/lib/pleroma/config.ex @@ -0,0 +1,26 @@ +defmodule Pleroma.Config do + def get([key]), do: get(key) + + def get([parent_key | keys]) do + Application.get_env(:pleroma, parent_key) + |> get_in(keys) + end + + def get(key) do + Application.get_env(:pleroma, key) + end + + def put([key], value), do: put(key, value) + + def put([parent_key | keys], value) do + parent = + Application.get_env(:pleroma, parent_key) + |> put_in(keys, value) + + Application.put_env(:pleroma, parent_key, parent) + end + + def put(key, value) do + Application.put_env(:pleroma, key, value) + end +end |