Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
],
locals_without_parens: [oban_dashboard: 1],
subdirectories: ["priv/*/migrations"],
plugins: [Phoenix.LiveView.HTMLFormatter],
plugins: [Phoenix.LiveView.HTMLFormatter, Quokka],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/*.exs"]
]
4 changes: 2 additions & 2 deletions .iex.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alias Garage.Accounts
alias Garage.Accounts.User
alias Garage.Builds
alias Garage.Builds.Build
alias Garage.Mopeds
alias Garage.Mopeds.Make
alias Garage.Mopeds.Model
alias Garage.Accounts
alias Garage.Accounts.User
88 changes: 42 additions & 46 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,28 @@
# General application configuration
import Config

config :garage, Oban,
engine: Oban.Engines.Basic,
notifier: Oban.Notifiers.Postgres,
queues: [default: 10],
repo: Garage.Repo
# Configure esbuild (the version is required)
config :esbuild,
version: "0.17.11",
default: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/* --external:/js/service-worker.js --external:js/heroicons.tailwind.plugin.js),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]

config :garage,
ecto_repos: [Garage.Repo],
generators: [timestamp_type: :utc_datetime]
config :ex_aws,
http_client: ExAws.Finch,
json_codec: Jason

# Configures the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :garage, Garage.Mailer, adapter: Swoosh.Adapters.Local

# Configures the endpoint
config :garage, GarageWeb.Endpoint,
Expand All @@ -28,24 +41,28 @@ config :garage, GarageWeb.Endpoint,
pubsub_server: Garage.PubSub,
live_view: [signing_salt: "bViCUv7u"]

# Configures the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :garage, Garage.Mailer, adapter: Swoosh.Adapters.Local
config :garage, Oban,
engine: Oban.Engines.Basic,
notifier: Oban.Notifiers.Postgres,
queues: [default: 10, resize: 20, push: 20],
repo: Garage.Repo

# Configure esbuild (the version is required)
config :esbuild,
version: "0.17.11",
default: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/* --external:/js/service-worker.js --external:js/heroicons.tailwind.plugin.js),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
config :garage,
ash_domains: [Garage.Builds, Garage.Mopeds, Garage.Accounts],
env: config_env(),
max_upload_size: 15_000_000

config :garage,
ecto_repos: [Garage.Repo],
generators: [timestamp_type: :utc_datetime]

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, JSON

# Configure tailwind (the version is required)
config :tailwind,
Expand All @@ -58,27 +75,6 @@ config :tailwind,
cd: Path.expand("../assets", __DIR__)
]

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, JSON

config :ex_aws,
http_client: ExAws.Finch,
json_codec: Jason

config :garage,
ash_domains: [Garage.Builds, Garage.Mopeds, Garage.Accounts],
env: config_env(),
max_upload_size: 15_000_000

config :garage, Oban,
repo: Garage.Repo,
queues: [resize: 20, push: 20]

# config :crawly,
# closespider_timeout: 10,
# concurrent_requests_per_domain: 8,
Expand Down
76 changes: 38 additions & 38 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import Config

# Configure your database
config :garage, Garage.Repo,
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we can use it
# to bundle .js and .css sources.
username: "postgres",
password: "postgres",
hostname: "localhost",
Expand All @@ -10,12 +16,6 @@ config :garage, Garage.Repo,
show_sensitive_data_on_connection_error: true,
pool_size: 10

# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we can use it
# to bundle .js and .css sources.
config :garage, GarageWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
Expand All @@ -29,63 +29,63 @@ config :garage, GarageWeb.Endpoint,
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
]

# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# Mix task:
#
# mix phx.gen.cert
#
# Run `mix help phx.gen.cert` for more information.
#
# The `http:` config above can be replaced with:
#
# https: [
# port: 4001,
# cipher_suite: :strong,
# keyfile: "priv/cert/selfsigned_key.pem",
# certfile: "priv/cert/selfsigned.pem"
# ],
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.

# Watch static and templates for browser reloading.
config :garage, GarageWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/garage_web/(controllers|live|components)/.*(ex|heex)$",
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# Mix task:
~r"lib/garage_web/pyro_overrides.ex"
]
]

# Enable dev routes for dashboard and mailbox
#
# mix phx.gen.cert
#
# Run `mix help phx.gen.cert` for more information.
#
# The `http:` config above can be replaced with:
#
# https: [
# port: 4001,
config :garage, dev_routes: true

config :garage,
upload_bucket: :dev,
public_image_root: "https://pub-09d9519a20aa4503bc4336772b724d1a.r2.dev",
discord_channel: 1_388_349_484_383_207_516,
site_url: "http://localhost:4000"

# Do not include metadata nor timestamps in development logs
# cipher_suite: :strong,
# keyfile: "priv/cert/selfsigned_key.pem",
# certfile: "priv/cert/selfsigned.pem"
# ],
config :logger, :console, format: "[$level] $message\n"

# Initialize plugs at runtime for faster development compilation
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
config :phoenix, :plug_init_mode, :runtime

# Set a higher stacktrace during development. Avoid configuring such
# different ports.

# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20

# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime

# Include HEEx debug annotations as HTML comments in rendered markup
config :phoenix_live_view, :debug_heex_annotations, true

# Disable swoosh api client as it is only required for production adapters.
config :swoosh, :api_client, false

config :garage,
upload_bucket: :dev,
public_image_root: "https://pub-09d9519a20aa4503bc4336772b724d1a.r2.dev",
discord_channel: 1_388_349_484_383_207_516,
site_url: "http://localhost:4000"

import_config("dev.secret.exs")
38 changes: 19 additions & 19 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import Config

# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# 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 :garage, GarageWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"

# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Garage.Finch
config :ex_aws, :s3,
scheme: "https://",
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix assets.deploy` task,
# which you should run after static files are built and
# before starting your production server.
host: "4e7e19d415ae25f4681ff5aa75b38d98.r2.cloudflarestorage.com"

# Disable Swoosh Local Memory Storage
config :swoosh, local: false
config :ex_aws,
region: "auto"

# Do not print debug messages in production
config :logger, level: :info
config :garage, GarageWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"

# Runtime production configuration, including reading
# of environment variables, is done on config/runtime.exs.
Expand All @@ -24,16 +22,18 @@ config :garage,
discord_channel: 1_237_258_590_675_402_794,
site_url: "https://moped.club"

config :ex_aws,
region: "auto"

config :ex_aws, :s3,
scheme: "https://",
host: "4e7e19d415ae25f4681ff5aa75b38d98.r2.cloudflarestorage.com"
# Do not print debug messages in production
config :logger, level: :info

config :sentry,
dsn:
"https://153ece384847272c7b3cc11a022af3c4@o4507110221283328.ingest.us.sentry.io/4507110223839232",
environment_name: Mix.env(),
enable_source_code_context: true,
root_source_code_paths: [File.cwd!()]

# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Garage.Finch

# Disable Swoosh Local Memory Storage
config :swoosh, local: false
36 changes: 18 additions & 18 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ if config_env() == :prod do

maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []

config :garage, Garage.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6

# 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
# want to use a different value for prod and you most likely don't want
Expand Down Expand Up @@ -72,12 +66,27 @@ if config_env() == :prod do
You can generate one by calling: mix generate.vapid.keys
"""

# ## Configuring the mailer
#
# In production you need to configure the mailer to use a different adapter.
# Also, you may need to configure the Swoosh API client of your choice if you
# are not using SMTP. Here is an example of the configuration:
#
config :garage, Garage.Mailer,
adapter: Swoosh.Adapters.Mailgun,
api_key: System.get_env("MAILGUN_API_KEY"),
domain: System.get_env("MAILGUN_DOMAIN")

config :garage, Garage.Push,
vapid_private_key: vapid_private_key,
vapid_public_key: vapid_public_key,
vapid_subject: vapid_subject

config :garage, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :garage, Garage.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6

config :garage, GarageWeb.Endpoint,
url: [host: host, port: 443, scheme: "https"],
Expand All @@ -91,16 +100,7 @@ if config_env() == :prod do
],
secret_key_base: secret_key_base

config :nostrum, token: System.get_env("NOSTRUM_TOKEN")
config :garage, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")

# ## Configuring the mailer
#
# In production you need to configure the mailer to use a different adapter.
# Also, you may need to configure the Swoosh API client of your choice if you
# are not using SMTP. Here is an example of the configuration:
#
config :garage, Garage.Mailer,
adapter: Swoosh.Adapters.Mailgun,
api_key: System.get_env("MAILGUN_API_KEY"),
domain: System.get_env("MAILGUN_DOMAIN")
config :nostrum, token: System.get_env("NOSTRUM_TOKEN")
end
Loading