@@ -56,3 +56,99 @@ config :phoenix, :json_library, Jason
5656# Import environment specific config. This must remain at the bottom
5757# of this file so it overrides the configuration defined above.
5858import_config "#{ config_env ( ) } .exs"
59+
60+ # config/runtime.exs is executed for all environments, including
61+ # during releases. It is executed after compilation and before the
62+ # system starts, so it is typically used to load production configuration
63+ # and secrets from environment variables or elsewhere. Do not define
64+ # any compile-time configuration in here, as it won't be applied.
65+
66+ if config_env ( ) == :prod do
67+ database_url =
68+ System . get_env ( "DATABASE_URL" ) ||
69+ raise """
70+ environment variable DATABASE_URL is missing.
71+ For example: ecto://USER:PASS@HOST/DATABASE
72+ """
73+
74+ maybe_ipv6 = if System . get_env ( "ECTO_IPV6" ) in ~w( true 1) , do: [ :inet6 ] , else: [ ]
75+
76+ config :kati_portfolio , KatiPortfolio.Repo ,
77+ # ssl: true,
78+ url: database_url ,
79+ pool_size: String . to_integer ( System . get_env ( "POOL_SIZE" ) || "10" ) ,
80+ socket_options: maybe_ipv6
81+
82+ # The secret key base is used to sign/encrypt cookies and other secrets.
83+ # A default value is used in config/dev.exs and config/test.exs but you
84+ # want to use a different value for prod and you most likely don't want
85+ # to check this value into version control, so we use an environment
86+ # variable instead.
87+ secret_key_base =
88+ System . get_env ( "SECRET_KEY_BASE" ) ||
89+ raise """
90+ environment variable SECRET_KEY_BASE is missing.
91+ You can generate one by calling: mix phx.gen.secret
92+ """
93+
94+ host = System . get_env ( "PHX_HOST" ) || "katibest.github.io"
95+ port = String . to_integer ( System . get_env ( "PORT" ) || "4000" )
96+
97+ config :kati_portfolio , KatiPortfolioWeb.Endpoint ,
98+ url: [ host: host , port: 443 , scheme: "https" ] ,
99+ http: [
100+ # Enable IPv6 and bind on all interfaces.
101+ # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
102+ # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
103+ ip: { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
104+ port: port
105+ ] ,
106+ secret_key_base: secret_key_base
107+
108+ # ## SSL Support
109+ #
110+ # To get SSL working, you will need to add the `https` key
111+ # to your endpoint configuration:
112+ #
113+ # config :kati_portfolio, KatiPortfolioWeb.Endpoint,
114+ # https: [
115+ # ...,
116+ # port: 443,
117+ # cipher_suite: :strong,
118+ # keyfile: System.get_env("SSL_KEYFILE"),
119+ # certfile: System.get_env("SSL_CERTFILE")
120+ # ]
121+ #
122+ # The `cipher_suite` is set to `:strong` to support only the
123+ # latest and more secure SSL ciphers. This means old browsers
124+ # and clients may not be supported. You can set it to
125+ # `:compatible` for wider support.
126+ #
127+ # `:keyfile` and `:certfile` expect an absolute path to the key
128+ # and cert in disk or a relative path inside priv, for example
129+ # "priv/ssl/server.key". For all supported SSL configuration
130+ # options, see https://hexdocs.pm/bandit/Bandit.html#t:options/0
131+
132+ # ## Configuring the mailer
133+ #
134+ # In production you need to configure the mailer to use a different adapter.
135+ # Also, you may need to configure the Swoosh API client of your choice if you
136+ # are not using SMTP. Here is an example of the configuration:
137+ #
138+ # config :kati_portfolio, KatiPortfolio.Mailer,
139+ # adapter: Swoosh.Adapters.Mailgun,
140+ # api_key: System.get_env("MAILGUN_API_KEY"),
141+ # domain: System.get_env("MAILGUN_DOMAIN")
142+ #
143+ # For this example you need include a HTTP client required by Swoosh API client.
144+ # Swoosh supports Hackney and Finch out of the box:
145+ #
146+ # config :swoosh, :api_client, Swoosh.ApiClient.Hackney
147+ #
148+ # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
149+ end
150+
151+ # Configure the base URL for GitHub Pages
152+ config :kati_portfolio , KatiPortfolioWeb.Endpoint ,
153+ url: [ scheme: "https" , host: "katibest.github.io" , port: 443 ] ,
154+ force_ssl: [ rewrite_on: [ :x_forwarded_proto ] ]
0 commit comments