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
+ # Start the phoenix server if environment is set and running in a release
11
+ if System . get_env ( "PHX_SERVER" ) && System . get_env ( "RELEASE_NAME" ) do
12
+ config :brasil_em_dados , BrasilEmDadosWeb.Endpoint , server: true
13
+ end
14
+
15
+ if config_env ( ) == :prod do
16
+ database_url =
17
+ System . get_env ( "DATABASE_URL" ) ||
18
+ raise """
19
+ environment variable DATABASE_URL is missing.
20
+ For example: ecto://USER:PASS@HOST/DATABASE
21
+ """
22
+
23
+ maybe_ipv6 = if System . get_env ( "ECTO_IPV6" ) , do: [ :inet6 ] , else: [ ]
24
+
25
+ config :brasil_em_dados , BrasilEmDados.Repo ,
26
+ # ssl: true,
27
+ url: database_url ,
28
+ pool_size: String . to_integer ( System . get_env ( "POOL_SIZE" ) || "10" ) ,
29
+ socket_options: maybe_ipv6
30
+ # show_sensitive_data_on_connection_error: true # The secret key base is used to sign/encrypt cookies and other secrets.
31
+ # A default value is used in config/dev.exs and config/test.exs but you
32
+ # want to use a different value for prod and you most likely don't want
33
+ # to check this value into version control, so we use an environment
34
+ # variable instead.
35
+ secret_key_base =
36
+ System . get_env ( "SECRET_KEY_BASE" ) ||
37
+ raise """
38
+ environment variable SECRET_KEY_BASE is missing.
39
+ You can generate one by calling: mix phx.gen.secret
40
+ """
41
+
42
+ host = System . get_env ( "PHX_HOST" ) || "brasilemdados.com"
43
+ port = String . to_integer ( System . get_env ( "PORT" ) || "4000" )
44
+
45
+ config :brasil_em_dados , BrasilEmDadosWeb.Endpoint ,
46
+ url: [ host: host , port: 443 ] ,
47
+ http: [
48
+ # Enable IPv6 and bind on all interfaces.
49
+ # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
50
+ # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
51
+ # for details about using IPv6 vs IPv4 and loopback vs public addresses.
52
+ ip: { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
53
+ port: port
54
+ ] ,
55
+ secret_key_base: secret_key_base ,
56
+ check_origin: false
57
+
58
+ # ## Using releases
59
+ #
60
+ # If you are doing OTP releases, you need to instruct Phoenix
61
+ # to start each relevant endpoint:
62
+ #
63
+ config :brasil_em_dados , BrasilEmDadosWeb.Endpoint , server: true
64
+ #
65
+ # Then you can assemble a release by calling `mix release`.
66
+ # See `mix help release` for more information.
67
+
68
+ # ## Configuring the mailer
69
+ #
70
+ # In production you need to configure the mailer to use a different adapter.
71
+ # Also, you may need to configure the Swoosh API client of your choice if you
72
+ # are not using SMTP. Here is an example of the configuration:
73
+ #
74
+ # config :brasil_em_dados, BrasilEmDados.Mailer,
75
+ # adapter: Swoosh.Adapters.Mailgun,
76
+ # api_key: System.get_env("MAILGUN_API_KEY"),
77
+ # domain: System.get_env("MAILGUN_DOMAIN")
78
+ #
79
+ # For this example you need include a HTTP client required by Swoosh API client.
80
+ # Swoosh supports Hackney and Finch out of the box:
81
+ #
82
+ # config :swoosh, :api_client, Swoosh.ApiClient.Hackney
83
+ #
84
+ # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
85
+ end
0 commit comments