From a9c6f119ac8fb2124241a61b26d97bff207218d8 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 22 Jan 2020 18:08:53 +0300 Subject: [PATCH] docs update --- docs/API/admin_api.md | 20 +++++++++++---- docs/admin/config.md | 34 ++++++++++++++++++++----- docs/administration/CLI_tasks/config.md | 6 ++--- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index 37cd1910d..534c49eed 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -682,11 +682,12 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` ## `GET /api/pleroma/admin/config` -### Get saved config settings +### Get list of merged default settings with saved in database. **Only works when configuration from database is enabled.** -- Params: none +- Params: + - `only_db`: true (*optional*, get only saved in database settings) - Response: - On failure: - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` @@ -734,7 +735,6 @@ Most of the settings will be applied in `runtime`, this means that you don't nee - all settings inside these keys: - `:hackney_pools` - `:chat` - - `Pleroma.Web.Endpoint` - partially settings inside these keys: - `:seconds_valid` in `Pleroma.Captcha` - `:proxy_remote` in `Pleroma.Upload` @@ -763,11 +763,10 @@ Example of setting without keyword in value: config :tesla, :adapter, Tesla.Adapter.Hackney ``` -List of settings which support only full update: +List of settings which support only full update by key: ```elixir @full_key_update [ {:pleroma, :ecto_repos}, - {:pleroma, :assets}, {:quack, :meta}, {:mime, :types}, {:cors_plug, [:max_age, :methods, :expose, :headers]}, @@ -777,6 +776,17 @@ List of settings which support only full update: ] ``` +List of settings which support only full update by subkey: +```elixir +@full_subkey_update [ + {:pleroma, :assets, :mascots}, + {:pleroma, :emoji, :groups}, + {:pleroma, :workers, :retries}, + {:pleroma, :mrf_subchain, :match_actor}, + {:pleroma, :mrf_keyword, :replace} + ] +``` + *Settings without explicit key must be sended in separate config object params.* ```elixir config :quack, diff --git a/docs/admin/config.md b/docs/admin/config.md index 41ca8fd58..35e43b6a9 100644 --- a/docs/admin/config.md +++ b/docs/admin/config.md @@ -8,14 +8,24 @@ config :pleroma, configurable_from_database: true ## How it works Settings are stored in database and are applied in `runtime` after each change. Most of the settings take effect immediately, except some, which need instance reboot. These settings are needed in `compile time`, that's why settings are duplicated to the file. -File with duplicated settings is located in `config/{env}.exported_from_db.exs`. For prod env it will be `config/prod.exported_from_db.exs`. +File with duplicated settings is located in `config/{env}.exported_from_db.exs` if pleroma is runned from source. For prod env it will be `config/prod.exported_from_db.exs`. + +For releases: `/etc/pleroma/prod.exported_from_db.secret.exs` or `PLEROMA_CONFIG_PATH/prod.exported_from_db.exs`. ## How to set it up -You need to migrate your existing settings to the database. You can do this with mix task (all config files will remain untouched): -```bash +You need to migrate your existing settings to the database. This task will migrate only added by user settings. +For example you add settings to `prod.secret.exs` file, only these settings will be migrated to database. For release it will be `/etc/pleroma/config.exs` or `PLEROMA_CONFIG_PATH`. +You can do this with mix task (all config files will remain untouched): + +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_to_db +``` + +```sh tab="From Source" mix pleroma.config migrate_to_db ``` -Now you can change settings in admin interface. After each save, settings are duplicated to the `config/{env}.exported_from_db.exs` file. + +Now you can change settings in admin interface. After each save, settings from database are duplicated to the `config/{env}.exported_from_db.exs` file. **ATTENTION** @@ -25,13 +35,25 @@ Now you can change settings in admin interface. After each save, settings are du - all settings inside these keys: - `:hackney_pools` - `:chat` - - `Pleroma.Web.Endpoint` - partially settings inside these keys: - `:seconds_valid` in `Pleroma.Captcha` - `:proxy_remote` in `Pleroma.Upload` - `:upload_limit` in `:instance` -## How to remove it +## How to dump settings from database to file + +*Adding `-d` flag will delete migrated settings from database table.* + +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_from_db [-d] +``` + +```sh tab="From Source" +mix pleroma.config migrate_from_db [-d] +``` + + +## How to completely remove it 1. Truncate or delete all values from `config` table ```sql diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md index fe76b534b..2af51c247 100644 --- a/docs/administration/CLI_tasks/config.md +++ b/docs/administration/CLI_tasks/config.md @@ -18,11 +18,11 @@ mix pleroma.config migrate_to_db ## Transfer config from DB to `config/env.exported_from_db.secret.exs` -To delete transfered settings from database optional flag `-d` can be used. +To delete transfered settings from database optional flag `-d` can be used. is `prod` by default. ```sh tab="OTP" - ./bin/pleroma_ctl config migrate_from_db --env= [-d] + ./bin/pleroma_ctl config migrate_from_db [--env=] [-d] ``` ```sh tab="From Source" -mix pleroma.config migrate_from_db --env= [-d] +mix pleroma.config migrate_from_db [--env=] [-d] ```