phx update

This commit is contained in:
2023-11-07 08:52:09 +01:00
parent 8ad54eda1c
commit b2439d7251
974 changed files with 4538 additions and 1120 deletions

View File

@ -7,8 +7,16 @@ import Config
# any compile-time configuration in here, as it won't be applied.
# The block below contains prod specific runtime configuration.
# Start the phoenix server if environment is set and running in a release
if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
# ## Using releases
#
# If you use `mix release`, you need to explicitly enable the server
# by passing the PHX_SERVER=true when you start it:
#
# PHX_SERVER=true bin/homepage start
#
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above.
if System.get_env("PHX_SERVER") do
config :homepage, HomepageWeb.Endpoint, server: true
end
@ -20,7 +28,7 @@ if config_env() == :prod do
For example: ecto://USER:PASS@HOST/DATABASE
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :homepage, Homepage.Repo,
# ssl: true,
@ -41,10 +49,12 @@ if config_env() == :prod do
"""
host = System.get_env("PHX_HOST") || "example.com"
cdn = System.get_env("PHX_CDN") || "cdn.example.com"
port = String.to_integer(System.get_env("PORT") || "4000")
config :homepage, HomepageWeb.Endpoint,
url: [host: host, port: 443],
url: [host: host, port: 443, scheme: "https"],
static_url: [host: cdn, port: 443, scheme: "https"],
http: [
# Enable IPv6 and bind on all interfaces.
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
@ -55,15 +65,37 @@ if config_env() == :prod do
],
secret_key_base: secret_key_base
# ## Using releases
# ## SSL Support
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
# To get SSL working, you will need to add the `https` key
# to your endpoint configuration:
#
# config :homepage, HomepageWeb.Endpoint, server: true
# config :homepage, HomepageWeb.Endpoint,
# https: [
# ...,
# port: 443,
# cipher_suite: :strong,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
# ]
#
# Then you can assemble a release by calling `mix release`.
# See `mix help release` for more information.
# The `cipher_suite` is set to `:strong` to support only the
# latest and more secure SSL ciphers. This means old browsers
# and clients may not be supported. You can set it to
# `:compatible` for wider support.
#
# `:keyfile` and `:certfile` expect an absolute path to the key
# and cert in disk or a relative path inside priv, for example
# "priv/ssl/server.key". For all supported SSL configuration
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
#
# We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https:
#
# config :homepage, HomepageWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# ## Configuring the mailer
#