Remove in-db configuration references from 1.1

It's still too unstable to be used.
This commit is contained in:
rinpatch 2019-10-04 15:51:48 +03:00
parent 70d18a278c
commit 1e6aa10168
5 changed files with 3 additions and 29 deletions

View file

@ -131,7 +131,6 @@ config :pleroma, Pleroma.Emails.Mailer,
* `user_name_length`: A user name maximum length (default: `100`) * `user_name_length`: A user name maximum length (default: `100`)
* `skip_thread_containment`: Skip filter out broken threads. The default is `false`. * `skip_thread_containment`: Skip filter out broken threads. The default is `false`.
* `limit_to_local_content`: Limit unauthenticated users to search for local statutes and users only. Possible values: `:unauthenticated`, `:all` and `false`. The default is `:unauthenticated`. * `limit_to_local_content`: Limit unauthenticated users to search for local statutes and users only. Possible values: `:unauthenticated`, `:all` and `false`. The default is `:unauthenticated`.
* `dynamic_configuration`: Allow transferring configuration to DB with the subsequent customization from Admin api.
* `max_account_fields`: The maximum number of custom fields in the user profile (default: `10`) * `max_account_fields`: The maximum number of custom fields in the user profile (default: `10`)
* `max_remote_account_fields`: The maximum number of custom fields in the remote user profile (default: `20`) * `max_remote_account_fields`: The maximum number of custom fields in the remote user profile (default: `20`)
* `account_field_name_length`: An account field name maximum length (default: `512`) * `account_field_name_length`: An account field name maximum length (default: `512`)

View file

@ -3,22 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Config do defmodule Mix.Tasks.Pleroma.Config do
@doc false
use Mix.Task use Mix.Task
import Mix.Pleroma import Mix.Pleroma
alias Pleroma.Repo alias Pleroma.Repo
alias Pleroma.Web.AdminAPI.Config alias Pleroma.Web.AdminAPI.Config
@shortdoc "Manages the location of the config"
@moduledoc """
Manages the location of the config.
## Transfers config from file to DB.
mix pleroma.config migrate_to_db
## Transfers config from DB to file `config/env.exported_from_db.secret.exs`
mix pleroma.config migrate_from_db ENV
"""
def run(["migrate_to_db"]) do def run(["migrate_to_db"]) do
start_pleroma() start_pleroma()

View file

@ -31,7 +31,6 @@ defmodule Mix.Tasks.Pleroma.Instance do
- `--dbpass DBPASS` - the password to use for the database connection - `--dbpass DBPASS` - the password to use for the database connection
- `--rum Y/N` - Whether to enable RUM indexes - `--rum Y/N` - Whether to enable RUM indexes
- `--indexable Y/N` - Allow/disallow indexing site by search engines - `--indexable Y/N` - Allow/disallow indexing site by search engines
- `--db-configurable Y/N` - Allow/disallow configuring instance from admin part
- `--uploads-dir` - the directory uploads go in when using a local uploader - `--uploads-dir` - the directory uploads go in when using a local uploader
- `--static-dir` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.) - `--static-dir` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)
- `--listen-ip` - the ip the app should listen to, defaults to 127.0.0.1 - `--listen-ip` - the ip the app should listen to, defaults to 127.0.0.1
@ -56,7 +55,6 @@ defmodule Mix.Tasks.Pleroma.Instance do
dbpass: :string, dbpass: :string,
rum: :string, rum: :string,
indexable: :string, indexable: :string,
db_configurable: :string,
uploads_dir: :string, uploads_dir: :string,
static_dir: :string, static_dir: :string,
listen_ip: :string, listen_ip: :string,
@ -113,14 +111,6 @@ defmodule Mix.Tasks.Pleroma.Instance do
"y" "y"
) === "y" ) === "y"
db_configurable? =
get_option(
options,
:db_configurable,
"Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n)",
"n"
) === "y"
dbhost = get_option(options, :dbhost, "What is the hostname of your database?", "localhost") dbhost = get_option(options, :dbhost, "What is the hostname of your database?", "localhost")
dbname = get_option(options, :dbname, "What is the name of your database?", "pleroma") dbname = get_option(options, :dbname, "What is the name of your database?", "pleroma")
@ -205,7 +195,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
signing_salt: signing_salt, signing_salt: signing_salt,
web_push_public_key: Base.url_encode64(web_push_public_key, padding: false), web_push_public_key: Base.url_encode64(web_push_public_key, padding: false),
web_push_private_key: Base.url_encode64(web_push_private_key, padding: false), web_push_private_key: Base.url_encode64(web_push_private_key, padding: false),
db_configurable?: db_configurable?, db_configurable?: false,
static_dir: static_dir, static_dir: static_dir,
uploads_dir: uploads_dir, uploads_dir: uploads_dir,
rum_enabled: rum_enabled, rum_enabled: rum_enabled,

View file

@ -20,8 +20,7 @@ config :pleroma, :instance,
email: "<%= email %>", email: "<%= email %>",
notify_email: "<%= notify_email %>", notify_email: "<%= notify_email %>",
limit: 5000, limit: 5000,
registrations_open: true, registrations_open: true
dynamic_configuration: <%= db_configurable? %>
config :pleroma, :media_proxy, config :pleroma, :media_proxy,
enabled: false, enabled: false,

View file

@ -41,8 +41,6 @@ defmodule Pleroma.InstanceTest do
"dbpass", "dbpass",
"--indexable", "--indexable",
"y", "y",
"--db-configurable",
"y",
"--rum", "--rum",
"y", "y",
"--listen-port", "--listen-port",
@ -69,7 +67,6 @@ defmodule Pleroma.InstanceTest do
assert generated_config =~ "database: \"dbname\"" assert generated_config =~ "database: \"dbname\""
assert generated_config =~ "username: \"dbuser\"" assert generated_config =~ "username: \"dbuser\""
assert generated_config =~ "password: \"dbpass\"" assert generated_config =~ "password: \"dbpass\""
assert generated_config =~ "dynamic_configuration: true"
assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]" assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]"
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql() assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()
end end