feat: make production ready

This commit is contained in:
Moritz Böhme 2025-05-15 08:31:26 +02:00
parent 0c721e9296
commit 3b196006c0
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
9 changed files with 87 additions and 70 deletions

View file

@ -51,7 +51,7 @@ config :putzplan,
# Configures the endpoint
config :putzplan, PutzplanWeb.Endpoint,
url: [host: "localhost"],
url: [host: "127.0.0.1"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: PutzplanWeb.ErrorHTML, json: PutzplanWeb.ErrorJSON],
@ -99,6 +99,8 @@ config :logger, :console,
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
config :exqlite, force_build: true
# 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"

View file

@ -3,8 +3,6 @@ config :live_debugger, browser_features?: true
# Configure your database
config :putzplan, Putzplan.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "tmp/putzplan_dev",
stacktrace: true,

View file

@ -5,7 +5,7 @@ import Config
# 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 :putzplan, PutzplanWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
config :putzplan, PutzplanWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json", server: true
# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Putzplan.Finch

View file

@ -21,20 +21,15 @@ if System.get_env("PHX_SERVER") do
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
database =
System.get_env("DATABASE") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
environment variable DATABASE is missing.
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :putzplan, Putzplan.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
database: database,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "1")
# The secret key base is used to sign/encrypt cookies and other secrets.
# A default value is used in config/dev.exs and config/test.exs but you