2 Commits

Author SHA1 Message Date
  Piotr Orzechowski 8d871cb892 Move listen port to config file 1 month ago
  Piotr Orzechowski bd91c40b90 Move listen port to config file 1 month ago

+ 1
- 1
apps/kv_server/config/config.exs View File

@@ -29,4 +29,4 @@ use Mix.Config
29 29
 #
30 30
 #     import_config "#{Mix.env()}.exs"
31 31
 
32
-config :kv_server, :listen_port, String.to_integer(System.get_env("KV_PORT") || "4040")
32
+config :kv_server, :listen_port, 4040

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

@@ -22,6 +22,8 @@ defmodule KVServer.Application do
22 22
   end
23 23
 
24 24
   defp listen_port() do
25
-    Application.fetch_env!(:kv_server, :listen_port)
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}")
26 28
   end
27 29
 end

+ 1
- 0
apps/kv_server/mix.exs View File

@@ -19,6 +19,7 @@ defmodule KVServer.MixProject do
19 19
   def application do
20 20
     [
21 21
       extra_applications: [:logger],
22
+      env: [listen_port: 4040],
22 23
       mod: {KVServer.Application, []}
23 24
     ]
24 25
   end

Loading…
Cancel
Save