This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
bdfr-browser/lib/bdfr_browser/application.ex

26 lines
845 B
Elixir
Raw Normal View History

2023-05-17 22:13:55 +00:00
defmodule BdfrBrowser.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
2023-08-13 23:18:55 +00:00
repos = Application.fetch_env!(:bdfr_browser, :ecto_repos)
2023-05-17 22:13:55 +00:00
{:ok, http_ip} = :inet.parse_address(Application.fetch_env!(:bdfr_browser, :http_ip))
http_port = Application.fetch_env!(:bdfr_browser, :http_port)
children = [
2023-08-13 23:18:55 +00:00
{Ecto.Migrator, repos: repos, skip: System.get_env("SKIP_MIGRATIONS") == "true"},
BdfrBrowser.Repo,
BdfrBrowser.Importer,
2023-05-17 22:13:55 +00:00
{Plug.Cowboy, scheme: :http, plug: BdfrBrowser.HTTP.Plug, options: [ip: http_ip, port: http_port]},
:systemd.ready()
]
opts = [strategy: :one_for_one, name: BdfrBrowser.Supervisor]
Supervisor.start_link(children, opts)
end
end