Skip to content

Commit 1f5d779

Browse files
committed
Select port from environment variable
This improves the dev setup when running the implementation natively with native developer tooling. It's not optimal as it requires a bunch of tools to be installed locally, but it serves the purpose.
1 parent 7c3bbef commit 1f5d779

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# FROM elixir-server
22
FROM madnificent/elixir-server:latest
33

4+
ENV PROXY_PORT 80
45
ADD . /app
56

67
RUN sh /setup.sh

lib/mu_elixir_cache.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ defmodule MuElixirCache do
55
use Application
66

77
def start(_type, _args) do
8+
public_port_env =
9+
System.get_env("PROXY_PORT") && elem(Integer.parse(System.get_env("PROXY_PORT")), 0)
10+
11+
port = public_port_env || 8888
12+
13+
814
IO.puts("Starting application")
915
# List all child processes to be supervised
1016
children = [
@@ -13,7 +19,7 @@ defmodule MuElixirCache do
1319
scheme: :http,
1420
plug: MuCachePlug,
1521
options: [
16-
port: 80,
22+
port: port,
1723
protocol_options: [max_header_value_length: 409_600_000, max_keepalive: 1000]
1824
]}
1925
]

0 commit comments

Comments
 (0)