ammocpr/lib/ammoprices/application.ex
Graham McIntire bbe5bde145
Initial implementation of ammo price tracker
Phoenix 1.8 app that scrapes ammunition retailers (Lucky Gunner,
SGAmmo) for price data and displays historical price trends.

- Data model: retailers, calibers, products, price snapshots
- Scraper infrastructure with Req, Floki, realistic browser headers
- Oban-scheduled scrape jobs (every 4h with randomized delays)
- LiveView pages: homepage with category cards, caliber detail with
  price table, Chart.js price history, and price stats banner
- 18 seeded calibers across handgun/rifle/rimfire/shotgun categories
- 77 tests
2026-03-11 15:58:12 -05:00

32 lines
965 B
Elixir

defmodule Ammoprices.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
AmmopricesWeb.Telemetry,
Ammoprices.Repo,
{DNSCluster, query: Application.get_env(:ammoprices, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: Ammoprices.PubSub},
{Oban, Application.fetch_env!(:ammoprices, Oban)},
AmmopricesWeb.Endpoint
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Ammoprices.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
AmmopricesWeb.Endpoint.config_change(changed, removed)
:ok
end
end