qb_akkoma/lib/pleroma/config/holder.ex

43 lines
1.2 KiB
Elixir
Raw Normal View History

2020-01-21 14:49:22 +00:00
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
2020-01-21 14:49:22 +00:00
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Config.Holder do
@config Pleroma.Config.Loader.default_config()
2020-03-11 14:22:50 +00:00
@spec save_default() :: :ok
def save_default do
default_config =
if System.get_env("RELEASE_NAME") do
Pleroma.Config.Loader.merge(@config, release_defaults())
else
@config
end
2020-03-11 14:22:50 +00:00
Pleroma.Config.put(:default_config, default_config)
end
@spec default_config() :: keyword()
2020-03-11 14:22:50 +00:00
def default_config, do: get_default()
@spec default_config(atom()) :: keyword()
2020-03-11 14:22:50 +00:00
def default_config(group), do: Keyword.get(get_default(), group)
@spec default_config(atom(), atom()) :: keyword()
2020-03-11 14:22:50 +00:00
def default_config(group, key), do: get_in(get_default(), [group, key])
2020-03-11 14:22:50 +00:00
defp get_default, do: Pleroma.Config.get(:default_config)
@spec release_defaults() :: keyword()
def release_defaults do
[
pleroma: [
2022-08-03 05:05:53 +00:00
{:instance, [static_dir: "/var/lib/akkoma/static"]},
{Pleroma.Uploaders.Local, [uploads: "/var/lib/akkoma/uploads"]},
{:modules, [runtime_dir: "/var/lib/akkoma/modules"]},
{:release, true}
]
]
end
end