1 # Transfering the config to/from the database
3 {! administration/CLI_tasks/general_cli_task_info.include !}
5 ## Transfer config from file to DB.
8 You need to add the following to your config before executing this command:
11 config :pleroma, configurable_from_database: true
17 ./bin/pleroma_ctl config migrate_to_db
23 mix pleroma.config migrate_to_db
26 ## Transfer config from DB to `config/env.exported_from_db.secret.exs`
29 In-Database configuration will still be applied after executing this command unless you set the following in your config:
32 config :pleroma, configurable_from_database: false
37 - `<path>` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non standart folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/akkoma`. For installation from source - `config` directory in the akkoma folder.
38 - `<env>` - environment, for which is migrated config. By default is `prod`.
39 - To delete transferred settings from database optional flag `-d` can be used
43 ./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d] [--path=<path>]
48 mix pleroma.config migrate_from_db [--env=<env>] [-d] [--path=<path>]
51 ## Dump all of the config settings defined in the database
56 ./bin/pleroma_ctl config dump
62 mix pleroma.config dump
65 ## List individual configuration groups in the database
70 ./bin/pleroma_ctl config groups
76 mix pleroma.config groups
79 ## Dump the saved configuration values for a specific group or key
81 e.g., this shows all the settings under `config :pleroma`
86 ./bin/pleroma_ctl config dump pleroma
92 mix pleroma.config dump pleroma
95 To get values under a specific key:
97 e.g., this shows all the settings under `config :pleroma, :instance`
102 ./bin/pleroma_ctl config dump pleroma instance
108 mix pleroma.config dump pleroma instance
111 ## Delete the saved configuration values for a specific group or key
113 e.g., this deletes all the settings under `config :tesla`
118 ./bin/pleroma_ctl config delete [--force] tesla
124 mix pleroma.config delete [--force] tesla
127 To delete values under a specific key:
129 e.g., this deletes all the settings under `config :phoenix, :stacktrace_depth`
134 ./bin/pleroma_ctl config delete [--force] phoenix stacktrace_depth
140 mix pleroma.config delete [--force] phoenix stacktrace_depth
143 ## Remove all settings from the database
145 This forcibly removes all saved values in the database.
150 ./bin/pleroma_ctl config [--force] reset
156 mix pleroma.config [--force] reset
159 ## Dumping specific configuration values to JSON
161 If you want to bulk-modify configuration values (for example, for MRF modifications),
162 it may be easier to dump the values to JSON and then modify them in a text editor.
167 ./bin/pleroma_ctl config dump_to_file group key path
168 # For example, to dump the MRF simple configuration:
169 ./bin/pleroma_ctl config dump_to_file pleroma mrf_simple /tmp/mrf_simple.json
175 mix pleroma.config dump_to_file group key path
176 # For example, to dump the MRF simple configuration:
177 mix pleroma.config dump_to_file pleroma mrf_simple /tmp/mrf_simple.json
180 ## Loading specific configuration values from JSON
182 **Note:** This will overwrite any existing value in the database, and can
183 cause crashes if you do not have exactly the correct formatting.
185 Once you have modified the JSON file, you can load it back into the database.
190 ./bin/pleroma_ctl config load_from_file path
191 # For example, to load the MRF simple configuration:
192 ./bin/pleroma_ctl config load_from_file /tmp/mrf_simple.json
198 mix pleroma.config load_from_file path
199 # For example, to load the MRF simple configuration:
200 mix pleroma.config load_from_file /tmp/mrf_simple.json
203 **NOTE** an instance reboot is needed for many changes to take effect,
204 you may want to visit `/api/v1/pleroma/admin/restart` on your instance
205 to soft-restart the instance.