Skip to content

Commit

Permalink
move certificates to secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed Oct 25, 2017
1 parent 9b6019d commit d1d3d37
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
10 changes: 9 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.1'

services:
web:
Expand All @@ -14,3 +14,11 @@ services:
- .:/home/elixir/app
- ../app:/home/elixir/tokumei
command: sh start.sh
secrets:
- certfile
- keyfile
secrets:
certfile:
file: ./secrets/certificate.pem
keyfile:
file: ./secrets/certificate_key.pem
17 changes: 8 additions & 9 deletions lib/water_cooler/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ defmodule WaterCooler.Application do
{:ok, secure_port} = env.secure_port
{:ok, service_name} = env.service_name

options = [port: secure_port, certfile: certificate_path, keyfile: certificate_key_path()]
options = [port: secure_port, certfile: "/run/secrets/certfile", keyfile: "/run/secrets/keyfile"]

# # File.ls("/run")
# # |> IO.inspect
# # File.ls("/run/secrets")
# # |> IO.inspect
# File.read("/run/secrets/certfile")
# # |> IO.inspect

children = [
# worker(WaterCooler.WWW, [[port: port()]], id: :http),
Expand All @@ -22,12 +29,4 @@ defmodule WaterCooler.Application do
opts = [strategy: :one_for_one, name: WaterCooler.Supervisor]
Supervisor.start_link(children, opts)
end

defp certificate_path() do
Application.app_dir(:water_cooler, "priv/localhost/certificate.pem")
end

defp certificate_key_path() do
Application.app_dir(:water_cooler, "priv/localhost/certificate_key.pem")
end
end
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule WaterCooler.Mixfile do

def project do
[
# TODO make :www
app: :water_cooler,
version: "0.0.1",
elixir: "~> 1.4",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d1d3d37

Please sign in to comment.