document dump_to_file and load_from_file

This commit is contained in:
FloatingGhost 2022-12-29 20:00:04 +00:00
parent d1bf8aa9ed
commit 5a405bdadf
2 changed files with 41 additions and 2 deletions

View file

@ -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
```

View file

@ -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