2 Commits

Author SHA1 Message Date
  Piotr Orzechowski 148867823c Move listen port to config file 1 month ago
  Piotr Orzechowski 8d871cb892 Move listen port to config file 1 month ago
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      apps/kv_server/lib/kv_server/application.ex

+ 4
- 3
apps/kv_server/lib/kv_server/application.ex View File

@@ -22,8 +22,9 @@ defmodule KVServer.Application do
22 22
   end
23 23
 
24 24
   defp listen_port() do
25
-    env_port = System.get_env("KV_PORT")
26
-    conf_port = Application.fetch_env!(:kv_server, :listen_port)
27
-    String.to_integer(env_port || "#{conf_port}")
25
+    case System.get_env("KV_PORT") do
26
+      nil -> Application.fetch_env!(:kv_server, :listen_port)
27
+      port -> String.to_integer(port)
28
+    end
28 29
   end
29 30
 end

Loading…
Cancel
Save