Merge branch 'fix/dynamic-configuration' into 'develop'

Fixes for dynamic configuration

See merge request pleroma/pleroma!1313
This commit is contained in:
lain 2019-06-20 17:43:57 +00:00
commit 3b48876cf0
5 changed files with 8 additions and 7 deletions

View file

@ -60,5 +60,5 @@
) )
end end
if File.exists?("./config/dev.migrated.secret.exs"), if File.exists?("./config/dev.exported_from_db.secret.exs"),
do: import_config("./config/dev.migrated.secret.exs") do: import_config("dev.exported_from_db.secret.exs")

View file

@ -64,5 +64,5 @@
# which should be versioned separately. # which should be versioned separately.
import_config "prod.secret.exs" import_config "prod.secret.exs"
if File.exists?("./config/prod.migrated.secret.exs"), if File.exists?("./config/prod.exported_from_db.secret.exs"),
do: import_config("./config/prod.migrated.secret.exs") do: import_config("prod.exported_from_db.secret.exs")

View file

@ -40,9 +40,10 @@ def run(["migrate_from_db", env]) do
Common.start_pleroma() Common.start_pleroma()
if Pleroma.Config.get([:instance, :dynamic_configuration]) do if Pleroma.Config.get([:instance, :dynamic_configuration]) do
config_path = "config/#{env}.migrated.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])
IO.write(file, "use Mix.Config\r\n")
Repo.all(Config) Repo.all(Config)
|> Enum.each(fn config -> |> Enum.each(fn config ->

View file

@ -5,7 +5,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
setup_all do setup_all do
Mix.shell(Mix.Shell.Process) Mix.shell(Mix.Shell.Process)
temp_file = "config/temp.migrated.secret.exs" temp_file = "config/temp.exported_from_db.secret.exs"
dynamic = Pleroma.Config.get([:instance, :dynamic_configuration]) dynamic = Pleroma.Config.get([:instance, :dynamic_configuration])

View file

@ -1334,7 +1334,7 @@ test "with settings in db", %{conn: conn} do
setup %{conn: conn} do setup %{conn: conn} do
admin = insert(:user, info: %{is_admin: true}) admin = insert(:user, info: %{is_admin: true})
temp_file = "config/test.migrated.secret.exs" temp_file = "config/test.exported_from_db.secret.exs"
on_exit(fn -> on_exit(fn ->
Application.delete_env(:pleroma, :key1) Application.delete_env(:pleroma, :key1)