From 2c40d565fa15051a54b04acbb31d534bac6b6b9a Mon Sep 17 00:00:00 2001
From: Norm <normandy@biribiri.dev>
Date: Wed, 3 Aug 2022 10:52:21 +0000
Subject: [PATCH] Fix config path lookup (#139)

Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/139
Co-authored-by: Norm <normandy@biribiri.dev>
Co-committed-by: Norm <normandy@biribiri.dev>
---
 lib/pleroma/config/release_runtime_provider.ex | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex
index 1e4bddc59..e5f2d6339 100644
--- a/lib/pleroma/config/release_runtime_provider.ex
+++ b/lib/pleroma/config/release_runtime_provider.ex
@@ -14,10 +14,10 @@ def load(config, opts) do
     config_path =
       cond do
         opts[:config_path] -> opts[:config_path]
-        System.get_env("PLEROMA_CONFIG_PATH") -> System.get_env("PLEROMA_CONFIG_PATH")
         System.get_env("AKKOMA_CONFIG_PATH") -> System.get_env("AKKOMA_CONFIG_PATH")
-        File.exists?("/etc/akkoma/config.exs") -> "/etc/akkoma/config.exs"
-        true -> "/etc/pleroma/config.exs"
+        System.get_env("PLEROMA_CONFIG_PATH") -> System.get_env("PLEROMA_CONFIG_PATH")
+        File.exists?("/etc/pleroma/config.exs") -> "/etc/pleroma/config.exs"
+        true -> "/etc/akkoma/config.exs"
       end
 
     with_runtime_config =
@@ -31,7 +31,7 @@ def load(config, opts) do
         warning = [
           IO.ANSI.red(),
           IO.ANSI.bright(),
-          "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file",
+          "!!! Config path is not declared! Please ensure it exists and that AKKOMA_CONFIG_PATH and/or PLEROMA_CONFIG_PATH is unset or points to an existing file",
           IO.ANSI.reset()
         ]