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