fc9f3cbd5e1c1e9fd5f359605b9fc7c7c3f1d553
[anni] / docs / administration / CLI_tasks / config.md
1 # Transfering the config to/from the database
2
3 {! backend/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/pleroma`. For installation from source - `config` directory in the pleroma 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     ```