101 lines
3.6 kB
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/blog 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 :blog, BlogWeb.Endpoint, server: true
21
end
22
23
if config_env() == :prod do
24
secret_key_base =
25
System.get_env("SECRET_KEY_BASE") ||
26
raise """
27
environment variable SECRET_KEY_BASE is missing.
28
You can generate one by calling: mix phx.gen.secret
29
"""
30
31
host = System.get_env("PHX_HOST") || "example.com"
32
port = String.to_integer(System.get_env("PORT") || "4000")
33
34
config :blog, BlogWeb.Endpoint,
35
url: [host: "bobbby.online", port: 443],
36
check_origin: [
37
"https://bobbby.online",
38
"https://www.bobbby.online",
39
# Add your Gigalixir app URL
40
"https://salmon-unselfish-aphid.gigalixirapp.com"
41
],
42
http: [
43
ip: {0, 0, 0, 0, 0, 0, 0, 0},
44
port: port
45
],
46
secret_key_base: secret_key_base
47
48
# ## SSL Support
49
#
50
# To get SSL working, you will need to add the `https` key
51
# to your endpoint configuration:
52
#
53
# config :blog, BlogWeb.Endpoint,
54
# https: [
55
# ...,
56
# port: 443,
57
# cipher_suite: :strong,
58
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
59
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
60
# ]
61
#
62
# The `cipher_suite` is set to `:strong` to support only the
63
# latest and more secure SSL ciphers. This means old browsers
64
# and clients may not be supported. You can set it to
65
# `:compatible` for wider support.
66
#
67
# `:keyfile` and `:certfile` expect an absolute path to the key
68
# and cert in disk or a relative path inside priv, for example
69
# "priv/ssl/server.key". For all supported SSL configuration
70
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
71
#
72
# We also recommend setting `force_ssl` in your config/prod.exs,
73
# ensuring no data is ever sent via http, always redirecting to https:
74
#
75
# config :blog, BlogWeb.Endpoint,
76
# force_ssl: [hsts: true]
77
#
78
# Check `Plug.SSL` for all available options in `force_ssl`.
79
80
# ## Configuring the mailer
81
#
82
# In production you need to configure the mailer to use a different adapter.
83
# Also, you may need to configure the Swoosh API client of your choice if you
84
# are not using SMTP. Here is an example of the configuration:
85
#
86
# config :blog, Blog.Mailer,
87
# adapter: Swoosh.Adapters.Mailgun,
88
# api_key: System.get_env("MAILGUN_API_KEY"),
89
# domain: System.get_env("MAILGUN_DOMAIN")
90
#
91
# For this example you need include a HTTP client required by Swoosh API client.
92
# Swoosh supports Hackney and Finch out of the box:
93
#
94
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
95
#
96
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
97
98
config :blog, :nats,
99
host: System.get_env("NATS_HOST", "localhost"),
100
port: String.to_integer(System.get_env("NATS_PORT", "4222"))
101
end
102