|
| 1 | +import Config |
| 2 | + |
| 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 is typically used to 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 | + |
| 10 | +# ## Using releases |
| 11 | +# |
| 12 | +# If you use `mix release`, you need to explicitly enable the server |
| 13 | +# by passing the PHX_SERVER=true when you start it: |
| 14 | +# |
| 15 | +# PHX_SERVER=true bin/imogen start |
| 16 | +# |
| 17 | +# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server` |
| 18 | +# script that automatically sets the env var above. |
| 19 | +if System.get_env("PHX_SERVER") do |
| 20 | + config :imogen, ImogenWeb.Endpoint, server: true |
| 21 | +end |
| 22 | + |
| 23 | +if config_env() == :prod do |
| 24 | + # The secret key base is used to sign/encrypt cookies and other secrets. |
| 25 | + # A default value is used in config/dev.exs and config/test.exs but you |
| 26 | + # want to use a different value for prod and you most likely don't want |
| 27 | + # to check this value into version control, so we use an environment |
| 28 | + # variable instead. |
| 29 | + secret_key_base = |
| 30 | + System.get_env("SECRET_KEY_BASE") || |
| 31 | + raise """ |
| 32 | + environment variable SECRET_KEY_BASE is missing. |
| 33 | + You can generate one by calling: mix phx.gen.secret |
| 34 | + """ |
| 35 | + |
| 36 | + host = System.get_env("PHX_HOST") || "example.com" |
| 37 | + port = String.to_integer(System.get_env("PORT") || "4000") |
| 38 | + |
| 39 | + config :imogen, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") |
| 40 | + |
| 41 | + config :imogen, ImogenWeb.Endpoint, |
| 42 | + url: [host: host, port: 443, scheme: "https"], |
| 43 | + http: [ |
| 44 | + # Enable IPv6 and bind on all interfaces. |
| 45 | + # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. |
| 46 | + # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0 |
| 47 | + # for details about using IPv6 vs IPv4 and loopback vs public addresses. |
| 48 | + ip: {0, 0, 0, 0, 0, 0, 0, 0}, |
| 49 | + port: port |
| 50 | + ], |
| 51 | + secret_key_base: secret_key_base |
| 52 | + |
| 53 | + # ## SSL Support |
| 54 | + # |
| 55 | + # To get SSL working, you will need to add the `https` key |
| 56 | + # to your endpoint configuration: |
| 57 | + # |
| 58 | + # config :imogen, ImogenWeb.Endpoint, |
| 59 | + # https: [ |
| 60 | + # ..., |
| 61 | + # port: 443, |
| 62 | + # cipher_suite: :strong, |
| 63 | + # keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), |
| 64 | + # certfile: System.get_env("SOME_APP_SSL_CERT_PATH") |
| 65 | + # ] |
| 66 | + # |
| 67 | + # The `cipher_suite` is set to `:strong` to support only the |
| 68 | + # latest and more secure SSL ciphers. This means old browsers |
| 69 | + # and clients may not be supported. You can set it to |
| 70 | + # `:compatible` for wider support. |
| 71 | + # |
| 72 | + # `:keyfile` and `:certfile` expect an absolute path to the key |
| 73 | + # and cert in disk or a relative path inside priv, for example |
| 74 | + # "priv/ssl/server.key". For all supported SSL configuration |
| 75 | + # options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1 |
| 76 | + # |
| 77 | + # We also recommend setting `force_ssl` in your config/prod.exs, |
| 78 | + # ensuring no data is ever sent via http, always redirecting to https: |
| 79 | + # |
| 80 | + # config :imogen, ImogenWeb.Endpoint, |
| 81 | + # force_ssl: [hsts: true] |
| 82 | + # |
| 83 | + # Check `Plug.SSL` for all available options in `force_ssl`. |
| 84 | +end |
0 commit comments