Merge branch 'fix/1399' into 'develop'

fix for migrate config to db task

Closes #1399

See merge request pleroma/pleroma!1964
This commit is contained in:
lain 2019-11-11 12:13:45 +00:00
commit 417f9a782f
3 changed files with 6 additions and 2 deletions

View File

@ -45,7 +45,7 @@ def run(["migrate_from_db", env, delete?]) do
if Pleroma.Config.get([:instance, :dynamic_configuration]) do if Pleroma.Config.get([:instance, :dynamic_configuration]) do
config_path = "config/#{env}.exported_from_db.secret.exs" config_path = "config/#{env}.exported_from_db.secret.exs"
{:ok, file} = File.open(config_path, [:write]) {:ok, file} = File.open(config_path, [:write, :utf8])
IO.write(file, "use Mix.Config\r\n") IO.write(file, "use Mix.Config\r\n")
Repo.all(Config) Repo.all(Config)

View File

@ -5,7 +5,7 @@ defmodule Pleroma.Docs.JSON do
def process(descriptions) do def process(descriptions) do
config_path = "docs/generate_config.json" config_path = "docs/generate_config.json"
with {:ok, file} <- File.open(config_path, [:write]), with {:ok, file} <- File.open(config_path, [:write, :utf8]),
json <- generate_json(descriptions), json <- generate_json(descriptions),
:ok <- IO.write(file, json), :ok <- IO.write(file, json),
:ok <- File.close(file) do :ok <- File.close(file) do

View File

@ -2269,6 +2269,10 @@ test "delete part of settings by atom subkeys", %{conn: conn} do
Pleroma.Config.put([:instance, :dynamic_configuration], true) Pleroma.Config.put([:instance, :dynamic_configuration], true)
end end
clear_config([:feed, :post_title]) do
Pleroma.Config.put([:feed, :post_title], %{max_length: 100, omission: ""})
end
test "transfer settings to DB and to file", %{conn: conn, admin: admin} do test "transfer settings to DB and to file", %{conn: conn, admin: admin} do
assert Pleroma.Repo.all(Pleroma.Web.AdminAPI.Config) == [] assert Pleroma.Repo.all(Pleroma.Web.AdminAPI.Config) == []
conn = get(conn, "/api/pleroma/admin/config/migrate_to_db") conn = get(conn, "/api/pleroma/admin/config/migrate_to_db")