Fixes for dynamic configuration
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Thu, 20 Jun 2019 17:43:57 +0000 (17:43 +0000)
committerlain <lain@soykaf.club>
Thu, 20 Jun 2019 17:43:57 +0000 (17:43 +0000)
config/dev.exs
config/prod.exs
lib/mix/tasks/pleroma/config.ex
test/tasks/config_test.exs
test/web/admin_api/admin_api_controller_test.exs

index 71b11f7c3ebb0b3dc604cdf602fc6dc903cedf47..7e1e3b4beb2a5add28c054f79f71c3ee328708ae 100644 (file)
@@ -60,5 +60,5 @@ else
   )
 end
 
-if File.exists?("./config/dev.migrated.secret.exs"),
-  do: import_config("./config/dev.migrated.secret.exs")
+if File.exists?("./config/dev.exported_from_db.secret.exs"),
+  do: import_config("dev.exported_from_db.secret.exs")
index 42edccf644fcb1622bc7769e6e8ebf094fcc0132..9c205cbd2f02cde66445e94235a807413dcf70e0 100644 (file)
@@ -64,5 +64,5 @@ config :logger, level: :warn
 # which should be versioned separately.
 import_config "prod.secret.exs"
 
-if File.exists?("./config/prod.migrated.secret.exs"),
-  do: import_config("./config/prod.migrated.secret.exs")
+if File.exists?("./config/prod.exported_from_db.secret.exs"),
+  do: import_config("prod.exported_from_db.secret.exs")
index 1fe03088d942d1098a08f9620b520490395646ca..d008871a1560b0c90931b418b9afc7e057f41d1c 100644 (file)
@@ -40,9 +40,10 @@ defmodule Mix.Tasks.Pleroma.Config do
     Common.start_pleroma()
 
     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])
+      IO.write(file, "use Mix.Config\r\n")
 
       Repo.all(Config)
       |> Enum.each(fn config ->
index 7d3b1860c709fb0042075dbab3f2c588b1175036..d448b04446e285dbb5b6209c72c6b24f442c309f 100644 (file)
@@ -5,7 +5,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
 
   setup_all do
     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])
 
index 18f64f2b717f41c5c1e2d1bdd356a807c77b0789..2a591264597061644a23df51ab11da43cc1e892a 100644 (file)
@@ -1334,7 +1334,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
     setup %{conn: conn} do
       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 ->
         Application.delete_env(:pleroma, :key1)