fix for migrate task
This commit is contained in:
parent
7438c177d9
commit
6a4201e0b4
3 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue