runtime.exs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. config :toy, Toy.Repo,
  29. # ssl: true,
  30. url: env.database_url,
  31. pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
  32. # ## Using releases
  33. #
  34. # If you are doing OTP releases, you need to instruct Phoenix
  35. # to start each relevant endpoint:
  36. #
  37. # config :<%= @web_app_name %>, <%= @endpoint_module %>, server: true
  38. #
  39. # Then you can assemble a release by calling `mix release`.
  40. # See `mix help release` for more information.
  41. end