From: FloatingGhost Date: Thu, 29 Dec 2022 20:00:04 +0000 (+0000) Subject: document dump_to_file and load_from_file X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=5a405bdadfbad41f08b609925300255b856c2f79;p=akkoma document dump_to_file and load_from_file --- diff --git a/docs/docs/administration/CLI_tasks/config.md b/docs/docs/administration/CLI_tasks/config.md index a0199d06f..490d6315f 100644 --- a/docs/docs/administration/CLI_tasks/config.md +++ b/docs/docs/administration/CLI_tasks/config.md @@ -155,3 +155,42 @@ This forcibly removes all saved values in the database. ```sh mix pleroma.config [--force] reset ``` + +## Dumping specific configuration values to JSON + +If you want to bulk-modify configuration values (for example, for MRF modifications), +it may be easier to dump the values to JSON and then modify them in a text editor. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config dump_to_file group key path + # For example, to dump the MRF simple configuration: + ./bin/pleroma_ctl config dump_to_file pleroma mrf_simple /tmp/mrf_simple.json + ``` + +=== "From Source" + + ```sh + mix pleroma.config dump_to_file group key path + # For example, to dump the MRF simple configuration: + mix pleroma.config dump_to_file pleroma mrf_simple /tmp/mrf_simple.json + ``` + +## Loading specific configuration values from JSON + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config load_from_file path + # For example, to load the MRF simple configuration: + ./bin/pleroma_ctl config load_from_file /tmp/mrf_simple.json + ``` + +=== "From Source" + + ```sh + mix pleroma.config load_from_file path + # For example, to load the MRF simple configuration: + mix pleroma.config load_from_file /tmp/mrf_simple.json + ``` diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index e70ca709a..dfde6520d 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -79,7 +79,7 @@ defmodule Mix.Tasks.Pleroma.Config do end) end - def run(["dump_to_file", group, key]) do + def run(["dump_to_file", group, key, fname]) do check_configdb(fn -> start_pleroma() @@ -95,7 +95,7 @@ defmodule Mix.Tasks.Pleroma.Config do |> Jason.encode!() |> Jason.Formatter.pretty_print() - File.write("#{group}_#{key}.json", json) + File.write(fname, json) shell_info("Wrote #{group}_#{key}.json") end) end