From f7f1a9e0947049b2094f91528d769ebb3baf8149 Mon Sep 17 00:00:00 2001 From: Shahryar Tavakkoli Date: Sun, 30 Jun 2024 11:40:23 +0330 Subject: [PATCH] VIP - change some app env section name --- lib/mishka_installer.ex | 7 +++++-- lib/mnesia_repo.ex | 2 +- test/event/event_test.exs | 6 +++++- test/event/hook_test.exs | 6 +++++- test/installer/installer_test.exs | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/mishka_installer.ex b/lib/mishka_installer.ex index 9cd09da..cb5e6f2 100644 --- a/lib/mishka_installer.ex +++ b/lib/mishka_installer.ex @@ -255,10 +255,13 @@ defmodule MishkaInstaller do - Set `MIX_ENV` as the **System env** or `:mishka, :project_env` as the **Application env** """ def __information__() do - env = System.get_env("MIX_ENV") || Application.get_env(:mishka, :project_env) || @project_env + env = + System.get_env("MIX_ENV") || Application.get_env(:mishka_installer, :project_env) || + @project_env %{ - path: System.get_env("PROJECT_PATH") || Application.get_env(:mishka, :project_path), + path: + System.get_env("PROJECT_PATH") || Application.get_env(:mishka_installer, :project_path), env: if(is_atom(env), do: env, else: String.to_atom(env)) } end diff --git a/lib/mnesia_repo.ex b/lib/mnesia_repo.ex index b746316..be187c0 100644 --- a/lib/mnesia_repo.ex +++ b/lib/mnesia_repo.ex @@ -44,7 +44,7 @@ defmodule MishkaInstaller.MnesiaRepo do ) mnesia_dir = ".mnesia" <> "/#{MishkaInstaller.__information__().env}" - config = Application.get_env(:mishka, Mishka.MnesiaRepo, mnesia_dir: mnesia_dir) + config = Application.get_env(:mishka_installer, Mishka.MnesiaRepo, mnesia_dir: mnesia_dir) File.mkdir_p(config[:mnesia_dir]) |> MError.error_description(@identifier) Application.put_env(:mnesia, :dir, config[:mnesia_dir] |> to_charlist) diff --git a/test/event/event_test.exs b/test/event/event_test.exs index 76da13c..43ce705 100644 --- a/test/event/event_test.exs +++ b/test/event/event_test.exs @@ -26,7 +26,11 @@ defmodule MishkaInstallerTest.Event.EventTest do Process.register(self(), :__mishka_installer_event_test__) - Application.put_env(:mishka, Mishka.MnesiaRepo, mnesia_dir: mnesia_dir, essential: [Event]) + Application.put_env(:mishka_installer, Mishka.MnesiaRepo, + mnesia_dir: mnesia_dir, + essential: [Event] + ) + MishkaInstaller.subscribe("mnesia") MishkaInstaller.subscribe("event") start_supervised!(MishkaInstaller.Event.EventHandler) diff --git a/test/event/hook_test.exs b/test/event/hook_test.exs index bd2fb01..6bb12c9 100644 --- a/test/event/hook_test.exs +++ b/test/event/hook_test.exs @@ -26,7 +26,11 @@ defmodule MishkaInstallerTest.Event.HookTest do Process.register(self(), :__mishka_installer_event_test__) - Application.put_env(:mishka, Mishka.MnesiaRepo, mnesia_dir: mnesia_dir, essential: [Event]) + Application.put_env(:mishka_installer, Mishka.MnesiaRepo, + mnesia_dir: mnesia_dir, + essential: [Event] + ) + MishkaInstaller.subscribe("mnesia") MishkaInstaller.subscribe("event") start_supervised!(MishkaInstaller.Event.EventHandler) diff --git a/test/installer/installer_test.exs b/test/installer/installer_test.exs index f76d542..420beb5 100644 --- a/test/installer/installer_test.exs +++ b/test/installer/installer_test.exs @@ -18,7 +18,7 @@ defmodule MishkaInstallerTest.Installer.InstallerTest do Process.register(self(), :__mishka_installer_test__) - Application.put_env(:mishka, Mishka.MnesiaRepo, + Application.put_env(:mishka_installer, Mishka.MnesiaRepo, mnesia_dir: mnesia_dir, essential: [Installer] )