Merge pull request 'docs: fedora install errata' (#398) from acuteaura/akkoma:acuteau...
[akkoma] / docs / docs / administration / CLI_tasks / config.md
1 # Transfering the config to/from the database
2
3 {! administration/CLI_tasks/general_cli_task_info.include !}
4
5 ## Transfer config from file to DB.
6
7 !!! note
8 You need to add the following to your config before executing this command:
9
10 ```elixir
11 config :pleroma, configurable_from_database: true
12 ```
13
14 === "OTP"
15
16 ```sh
17 ./bin/pleroma_ctl config migrate_to_db
18 ```
19
20 === "From Source"
21
22 ```sh
23 mix pleroma.config migrate_to_db
24 ```
25
26 ## Transfer config from DB to `config/env.exported_from_db.secret.exs`
27
28 !!! note
29 In-Database configuration will still be applied after executing this command unless you set the following in your config:
30
31 ```elixir
32 config :pleroma, configurable_from_database: false
33 ```
34
35 Options:
36
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
40
41 === "OTP"
42 ```sh
43 ./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d] [--path=<path>]
44 ```
45
46 === "From Source"
47 ```sh
48 mix pleroma.config migrate_from_db [--env=<env>] [-d] [--path=<path>]
49 ```
50
51 ## Dump all of the config settings defined in the database
52
53 === "OTP"
54
55 ```sh
56 ./bin/pleroma_ctl config dump
57 ```
58
59 === "From Source"
60
61 ```sh
62 mix pleroma.config dump
63 ```
64
65 ## List individual configuration groups in the database
66
67 === "OTP"
68
69 ```sh
70 ./bin/pleroma_ctl config groups
71 ```
72
73 === "From Source"
74
75 ```sh
76 mix pleroma.config groups
77 ```
78
79 ## Dump the saved configuration values for a specific group or key
80
81 e.g., this shows all the settings under `config :pleroma`
82
83 === "OTP"
84
85 ```sh
86 ./bin/pleroma_ctl config dump pleroma
87 ```
88
89 === "From Source"
90
91 ```sh
92 mix pleroma.config dump pleroma
93 ```
94
95 To get values under a specific key:
96
97 e.g., this shows all the settings under `config :pleroma, :instance`
98
99 === "OTP"
100
101 ```sh
102 ./bin/pleroma_ctl config dump pleroma instance
103 ```
104
105 === "From Source"
106
107 ```sh
108 mix pleroma.config dump pleroma instance
109 ```
110
111 ## Delete the saved configuration values for a specific group or key
112
113 e.g., this deletes all the settings under `config :tesla`
114
115 === "OTP"
116
117 ```sh
118 ./bin/pleroma_ctl config delete [--force] tesla
119 ```
120
121 === "From Source"
122
123 ```sh
124 mix pleroma.config delete [--force] tesla
125 ```
126
127 To delete values under a specific key:
128
129 e.g., this deletes all the settings under `config :phoenix, :stacktrace_depth`
130
131 === "OTP"
132
133 ```sh
134 ./bin/pleroma_ctl config delete [--force] phoenix stacktrace_depth
135 ```
136
137 === "From Source"
138
139 ```sh
140 mix pleroma.config delete [--force] phoenix stacktrace_depth
141 ```
142
143 ## Remove all settings from the database
144
145 This forcibly removes all saved values in the database.
146
147 === "OTP"
148
149 ```sh
150 ./bin/pleroma_ctl config [--force] reset
151 ```
152
153 === "From Source"
154
155 ```sh
156 mix pleroma.config [--force] reset
157 ```
158
159 ## Dumping specific configuration values to JSON
160
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.
163
164 === "OTP"
165
166 ```sh
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
170 ```
171
172 === "From Source"
173
174 ```sh
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
178 ```
179
180 ## Loading specific configuration values from JSON
181
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.
184
185 Once you have modified the JSON file, you can load it back into the database.
186
187 === "OTP"
188
189 ```sh
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
193 ```
194
195 === "From Source"
196
197 ```sh
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
201 ```
202
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.