alias Pleroma.Repo
alias Pleroma.Web.AdminAPI.Config
@shortdoc "Manages the location of the config"
- @moduledoc """
- Manages the location of the config.
-
- ## Transfers config from file to DB.
-
- mix pleroma.config migrate_to_db
-
- ## Transfers config from DB to file.
-
- mix pleroma.config migrate_from_db ENV
- """
-
+ @moduledoc File.read!("docs/administration/CLI_tasks/config.md")
def run(["migrate_to_db"]) do
start_pleroma()
if Pleroma.Config.get([:instance, :dynamic_configuration]) do
config_path = "config/#{env}.exported_from_db.secret.exs"
- {:ok, file} = File.open(config_path, [:write])
+ {:ok, file} = File.open(config_path, [:write, :utf8])
IO.write(file, "use Mix.Config\r\n")
Repo.all(Config)
|> Enum.each(fn config ->
IO.write(
file,
- "config :#{config.group}, #{config.key}, #{inspect(Config.from_binary(config.value))}\r\n\r\n"
+ "config :#{config.group}, #{config.key}, #{
+ inspect(Config.from_binary(config.value), limit: :infinity)
+ }\r\n\r\n"
)
if delete? do