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

@ -11,11 +11,16 @@ config :homepage,
ecto_repos: [Homepage.Repo]
# Configures the endpoint
host = System.get_env("PHX_HOST") || "localhost"
config :homepage, HomepageWeb.Endpoint,
url: [host: "www.rdiedri.ch"],
render_errors: [view: HomepageWeb.ErrorView, accepts: ~w(html json), layout: false],
adapter: Bandit.PhoenixAdapter,
url: [host: host],
render_errors: [
formats: [html: HomepageWeb.ErrorHTML, json: HomepageWeb.ErrorJSON],
layout: false
],
pubsub_server: Homepage.PubSub,
live_view: [signing_salt: "Ws4ex2xq"]
live_view: [signing_salt: "7d3vC+0c"]
# Configures the mailer
#
@ -26,12 +31,9 @@ config :homepage, HomepageWeb.Endpoint,
# at the `config/runtime.exs`.
config :homepage, Homepage.Mailer, adapter: Swoosh.Adapters.Local
# Swoosh API client is needed for adapters other than SMTP.
config :swoosh, :api_client, false
# Configure esbuild (the version is required)
config :esbuild,
version: "0.14.0",
version: "0.17.11",
default: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
@ -39,14 +41,17 @@ config :esbuild,
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
config :tailwind, version: "3.0.24", default: [
args: ~w(
--config=tailwind.config.js
--input=css/app.css
--output=../priv/static/assets/app.css
),
cd: Path.expand("../assets", __DIR__)
]
# Configure tailwind (the version is required)
config :tailwind,
version: "3.2.7",
default: [
args: ~w(
--config=tailwind.config.js
--input=css/app.css
--output=../priv/static/assets/app.css
),
cd: Path.expand("../assets", __DIR__)
]
# Configures Elixir's Logger
config :logger, :console,

View File

@ -5,8 +5,8 @@ config :homepage, Homepage.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
port: 5432,
database: "homepage_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
@ -19,13 +19,12 @@ config :homepage, Homepage.Repo,
config :homepage, HomepageWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000],
http: [ip: {0, 0, 0, 0}, port: 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: "aKJ7SFuEOLy0I/zpYQbQZt9HEsRHNTGeNRhd0/RFBoxgWPIsWBtZ2qPilEo5A6yS",
secret_key_base: "HiJgYCX+1XEGvFg6ctjDGqP5aAaFzyCbSmqYVeFhvkLVqCGm94tYQ4m2WExOnMUj",
watchers: [
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
]
@ -38,7 +37,6 @@ config :homepage, HomepageWeb.Endpoint,
#
# mix phx.gen.cert
#
# Note that this task requires Erlang/OTP 20 or later.
# Run `mix help phx.gen.cert` for more information.
#
# The `http:` config above can be replaced with:
@ -60,11 +58,13 @@ config :homepage, HomepageWeb.Endpoint,
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/homepage_web/(live|views)/.*(ex)$",
~r"lib/homepage_web/templates/.*(eex)$"
~r"lib/homepage_web/(controllers|live|components)/.*(ex|heex)$"
]
]
# Enable dev routes for dashboard and mailbox
config :homepage, dev_routes: true
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
@ -74,3 +74,6 @@ config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime
# Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false

View File

@ -3,47 +3,20 @@ import Config
# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
#
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# manifest is generated by the `mix assets.deploy` task,
# which you should run after static files are built and
# before starting your production server.
config :homepage, HomepageWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
config :homepage, HomepageWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json"
# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Homepage.Finch
# Do not print debug messages in production
config :logger, level: :info
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :homepage, HomepageWeb.Endpoint,
# ...,
# url: [host: "example.com", port: 443],
# https: [
# ...,
# port: 443,
# cipher_suite: :strong,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
# ]
#
# 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`.
# Runtime production configuration, including reading
# of environment variables, is done on config/runtime.exs.

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
#

View File

@ -17,14 +17,17 @@ config :homepage, Homepage.Repo,
# you can enable the server option below.
config :homepage, HomepageWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "4edrZ1YcleMolqOLMfLxvi8oxi6ZkRxoibuMugj9rW+zr/bGKi0N+hz8sD++zLc/",
secret_key_base: "s2QyAnSkP8WskaN/HwxLPGg3XQ8iJfUnpGDbQepVZ7zyre5ZObEAhUqT3cqX28bV",
server: false
# In test we don't send emails.
config :homepage, Homepage.Mailer, adapter: Swoosh.Adapters.Test
# Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false
# Print only warnings and errors during test
config :logger, level: :warn
config :logger, level: :warning
# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime