···1616# Do not print debug messages in production
1717config :logger, level: :info
18181919-# we use nix for building prod and it has a sandbox
2020-config :ex_git, ExGit, skip_compilation?: true
2121-2219# Runtime production configuration, including reading
2320# of environment variables, is done on config/runtime.exs.
+11-14
config/runtime.exs
···2020 config :sower, SowerWeb.Endpoint, server: true
2121end
22222323-config :sower,
2424- scm_secret: "five",
2525- working_dir: System.get_env("SOWER_WORKDIR", "#{File.cwd() |> elem(1)}/tmp")
2626-2723if config_env() == :prod do
2828- database_url =
2929- System.get_env("SOWER_DATABASE_URL") ||
3030- raise """
3131- environment variable SOWER_DATABASE_URL is missing.
3232- For example: ecto://postgres:postgres@localhost/ecto_simple
3333- """
2424+ db_pass_file =
2525+ System.get_env("SOWER_DATABASE_PASS_FILE") || raise "missing $SOWER_DATABASE_PASS_FILE"
34263535- config :sower, Sower.Repo, url: database_url, socket_options: [:inet6]
2727+ config :sower, Sower.Repo,
2828+ username: System.get_env("SOWER_DATABASE_USER", "postgres"),
2929+ password: db_pass_file |> File.read!() |> String.trim(),
3030+ hostname: System.get_env("SOWER_DATABASE_HOST", "localhost"),
3131+ database: System.get_env("SOWER_DATABASE_NAME", "sower"),
3232+ port: System.get_env("SOWER_DATABASE_PORT", "5432") |> String.to_integer()
36333734 # The secret key base is used to sign/encrypt cookies and other secrets.
3835 # A default value is used in config/dev.exs and config/test.exs but you
···4643 You can generate one by calling: mix phx.gen.secret
4744 """
48454949- host = System.get_env("SOWER_HOSTNAME") || "example.com"
5050- port = String.to_integer(System.get_env("SOWER_LISTEN_PORT") || "4000")
4646+ host = System.get_env("SOWER_HOSTNAME") || raise "missing $SOWER_HOSTNAME"
4747+ port = String.to_integer(System.get_env("SOWER_LISTEN_PORT", "4000"))
51485249 {:ok, listen_ip} =
5353- System.get_env("SOWER_LISTEN_ADDRESS", "::1")
5050+ System.get_env("SOWER_LISTEN_ADDRESS", "127.0.0.1")
5451 |> to_charlist()
5552 |> :inet.parse_address()
5653