runtime.exs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import Config
  2. alias Config.Helper
  3. # config/runtime.exs is executed for all environments, including
  4. # during releases. It is executed after compilation and before the
  5. # system starts, so it typically used load production configuration
  6. # and secrets from environment variables or elsewhere. Do not define
  7. # any compile-time configuration in here, as it won't be applied.
  8. # The block below contains prod specific runtime configuration.
  9. if config_env() == :prod do
  10. env =
  11. Helper.load_all([
  12. {"SECRET_KEY_BASE", "You can generate one by calling: mix phx.gen.secret"},
  13. {"DATABASE_URL", "For example: ecto://USER:PASS@HOST/DATABASE"},
  14. "PORT",
  15. "HOST"
  16. ])
  17. config :toy, ToyWeb.Endpoint,
  18. url: [host: env.host, port: env.port],
  19. http: [
  20. # Enable IPv6 and bind on all interfaces.
  21. # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
  22. # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
  23. # for details about using IPv6 vs IPv4 and loopback vs public addresses.
  24. ip: {0, 0, 0, 0, 0, 0, 0, 0},
  25. port: env.port
  26. ],
  27. secret_key_base: env.secret_key_base,
  28. server: true
  29. config :toy, Toy.Repo,
  30. # ssl: true,
  31. url: env.database_url,
  32. pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
  33. end