Document how to delete individual configuration groups and completely reset the config without SQL

This commit is contained in:
Mark Felder 2020-11-25 17:31:44 -06:00
parent a82ba66662
commit e8a4062d9d
2 changed files with 31 additions and 8 deletions

View file

@ -140,14 +140,24 @@ If you encounter a situation where the server cannot run properly because of an
e.g., here is an example showing a minimal configuration in the database. Only the `config :pleroma, :instance` settings are in the table: e.g., here is an example showing a minimal configuration in the database. Only the `config :pleroma, :instance` settings are in the table:
``` ```
psql -d pleroma_dev $ mix pleroma.config keylist
pleroma_dev=# select * from config; The following configuration keys are set in ConfigDB:
id | key | value | inserted_at | updated_at | group
----+-----------+------------------------------------------------------------+---------------------+---------------------+---------- - instance
1 | :instance | \x836c0000000168026400046e616d656d00000007426c65726f6d616a | 2020-07-12 15:33:29 | 2020-07-12 15:33:29 | :pleroma
(1 row) ```
pleroma_dev=# delete from config where key = ':instance' and group = ':pleroma';
DELETE 1 ```
$ mix pleroma.config show instance
config :pleroma, :instance, [name: "MyPleroma", description: "A fun place to hang out!", notify_email: "no-reply@mypleroma.com", email: "admin@mypleroma.com", account_activation_required: true]
```
To delete the saved settings for `:instance`:
```
$ mix pleroma.config keydel instance
instance deleted from the ConfigDB.
``` ```
Now the `config :pleroma, :instance` settings have been removed from the database. Now the `config :pleroma, :instance` settings have been removed from the database.

View file

@ -83,6 +83,19 @@ def run(["keylist"]) do
end end
end end
def run(["reset"]) do
with true <- Pleroma.Config.get([:configurable_from_database]) do
start_pleroma()
Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;")
Ecto.Adapters.SQL.query!(Repo, "ALTER SEQUENCE config_id_seq RESTART;")
shell_info("The ConfigDB settings have been removed from the database.")
else
_ -> configdb_not_enabled()
end
end
def run(["keydel" | dbkey]) do def run(["keydel" | dbkey]) do
unless [] == dbkey do unless [] == dbkey do
with true <- Pleroma.Config.get([:configurable_from_database]) do with true <- Pleroma.Config.get([:configurable_from_database]) do