Update the phoenix version and starting migration the project.
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-20 20:13:01 +03:00
parent 01efdc201d
commit 18bb0b13b6
89 changed files with 1472 additions and 3668 deletions
+22 -12
View File
@@ -8,14 +8,19 @@
import Config
config :link_shortener,
ecto_repos: [LinkShortener.Repo]
ecto_repos: [LinkShortener.Repo],
generators: [timestamp_type: :utc_datetime]
# Configures the endpoint
config :link_shortener, LinkShortenerWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: LinkShortenerWeb.ErrorView, accepts: ~w(html json), layout: false],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: LinkShortenerWeb.ErrorHTML, json: LinkShortenerWeb.ErrorJSON],
layout: false
],
pubsub_server: LinkShortener.PubSub,
live_view: [signing_salt: "8wxfzzEQ"]
live_view: [signing_salt: "+S5BXaoX"]
# Configures the mailer
#
@@ -26,19 +31,28 @@ config :link_shortener, LinkShortenerWeb.Endpoint,
# at the `config/runtime.exs`.
config :link_shortener, LinkShortener.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.29",
default: [
version: "0.17.11",
link_shortener: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
# Configure tailwind (the version is required)
config :tailwind,
version: "3.4.3",
link_shortener: [
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,
format: "$time $metadata[$level] $message\n",
@@ -47,10 +61,6 @@ config :logger, :console,
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
config :link_shortener, LinkShortenerWeb.Auth.Guardian,
issuer: "link_shortener",
secret_key: System.get_env("SECRET_KEY_BASE")
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"
+19 -9
View File
@@ -2,10 +2,10 @@ import Config
# Configure your database
config :link_shortener, LinkShortener.Repo,
database: System.get_env("DATABASE_NAME"),
username: System.get_env("DATABASE_USERNAME"),
password: System.get_env("DATABASE_PASSWORD"),
hostname: System.get_env("DATABASE_HOST"),
database: System.get_env("DATABASE_NAME"),
port: System.get_env("DATABASE_PORT"),
stacktrace: true,
show_sensitive_data_on_connection_error: true,
@@ -15,8 +15,8 @@ config :link_shortener, LinkShortener.Repo,
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
# watchers to your application. For example, we can use it
# to bundle .js and .css sources.
config :link_shortener, LinkShortenerWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
@@ -26,8 +26,8 @@ config :link_shortener, LinkShortenerWeb.Endpoint,
debug_errors: true,
secret_key_base: System.get_env("SECRET_KEY_BASE"),
watchers: [
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
esbuild: {Esbuild, :install_and_run, [:link_shortener, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:link_shortener, ~w(--watch)]}
]
# ## SSL Support
@@ -38,7 +38,6 @@ config :link_shortener, LinkShortenerWeb.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:
@@ -58,13 +57,15 @@ config :link_shortener, LinkShortenerWeb.Endpoint,
config :link_shortener, LinkShortenerWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/link_shortener_web/(live|views)/.*(ex)$",
~r"lib/link_shortener_web/templates/.*(eex)$"
~r"lib/link_shortener_web/(controllers|live|components)/.*(ex|heex)$"
]
]
# Enable dev routes for dashboard and mailbox
config :link_shortener, dev_routes: true
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
@@ -74,3 +75,12 @@ config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime
config :phoenix_live_view,
# Include HEEx debug annotations as HTML comments in rendered markup
debug_heex_annotations: true,
# Enable helpful, but potentially expensive runtime checks
enable_expensive_runtime_checks: true
# Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false
+36 -2
View File
@@ -28,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 :link_shortener, LinkShortener.Repo,
# ssl: true,
@@ -51,18 +51,52 @@ if config_env() == :prod do
host = System.get_env("PHX_HOST") || "example.com"
port = String.to_integer(System.get_env("PORT") || "4000")
config :link_shortener, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :link_shortener, LinkShortenerWeb.Endpoint,
url: [host: host, 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.
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
# See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: port
],
secret_key_base: secret_key_base
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to your endpoint configuration:
#
# config :link_shortener, LinkShortenerWeb.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")
# ]
#
# 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 config/prod.exs,
# ensuring no data is ever sent via http, always redirecting to https:
#
# config :link_shortener, LinkShortenerWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# ## Configuring the mailer
#
# In production you need to configure the mailer to use a different adapter.
+10 -6
View File
@@ -1,8 +1,5 @@
import Config
# Only in tests, remove the complexity from the password hashing algorithm
config :bcrypt_elixir, :log_rounds, 1
# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
@@ -14,7 +11,7 @@ config :link_shortener, LinkShortener.Repo,
hostname: System.get_env("DATABASE_HOST"),
database: "link_shortener_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10
pool_size: System.schedulers_online() * 2
# We don't run a server during test. If one is required,
# you can enable the server option below.
@@ -23,11 +20,18 @@ config :link_shortener, LinkShortenerWeb.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE"),
server: false
# In test we don't send emails.
# In test we don't send emails
config :link_shortener, LinkShortener.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
# Enable helpful, but potentially expensive runtime checks
config :phoenix_live_view,
enable_expensive_runtime_checks: true