| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import Config
- # config/runtime.exs is executed for all environments, including
- # during releases. It is executed after compilation and before the
- # system starts, so it typically used load production configuration
- # and secrets from environment variables or elsewhere. Do not define
- # any compile-time configuration in here, as it won't be applied.
- # The block below contains prod specific runtime configuration.
- if config_env() == :prod do
- secret_key_base =
- System.get_env("SECRET_KEY_BASE") ||
- raise """
- environment variable SECRET_KEY_BASE is missing.
- You can generate one by calling: mix phx.gen.secret
- """
- database_url =
- System.get_env("DATABASE_URL") ||
- raise """
- environment variable DATABASE_URL is missing.
- For example: ecto://USER:PASS@HOST/DATABASE
- """
- port =
- System.get_env("PORT") ||
- raise "environment variable PORT is missing."
- host =
- System.get_env("HOST") ||
- raise "environment variable HOST is missing."
- config :toy, ToyWeb.Endpoint,
- url: [host: host, port: port],
- http: [
- # Enable IPv6 and bind on all interfaces.
- # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
- # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
- # for details about using IPv6 vs IPv4 and loopback vs public addresses.
- ip: {0, 0, 0, 0, 0, 0, 0, 0},
- port: port
- ],
- secret_key_base: secret_key_base
- config :toy, Toy.Repo,
- # ssl: true,
- url: database_url,
- pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
- # ## Using releases
- #
- # If you are doing OTP releases, you need to instruct Phoenix
- # to start each relevant endpoint:
- #
- # config :<%= @web_app_name %>, <%= @endpoint_module %>, server: true
- #
- # Then you can assemble a release by calling `mix release`.
- # See `mix help release` for more information.
- end
|