An example AT Protocol application, written in Elixir using atex and Drinkup.
at main 42 lines 1.4 kB view raw
1defmodule Statusphere.Application do 2 # See https://hexdocs.pm/elixir/Application.html 3 # for more information on OTP Applications 4 @moduledoc false 5 6 use Application 7 8 @impl true 9 def start(_type, _args) do 10 children = [ 11 StatusphereWeb.Telemetry, 12 Statusphere.Repo, 13 {Ecto.Migrator, 14 repos: Application.fetch_env!(:statusphere, :ecto_repos), skip: skip_migrations?()}, 15 {DNSCluster, query: Application.get_env(:statusphere, :dns_cluster_query) || :ignore}, 16 {Phoenix.PubSub, name: Statusphere.PubSub}, 17 {Drinkup, %{consumer: Statusphere.Consumer}}, 18 # Start a worker by calling: Statusphere.Worker.start_link(arg) 19 # {Statusphere.Worker, arg}, 20 # Start to serve requests, typically the last entry 21 StatusphereWeb.Endpoint 22 ] 23 24 # See https://hexdocs.pm/elixir/Supervisor.html 25 # for other strategies and supported options 26 opts = [strategy: :one_for_one, name: Statusphere.Supervisor] 27 Supervisor.start_link(children, opts) 28 end 29 30 # Tell Phoenix to update the endpoint configuration 31 # whenever the application is updated. 32 @impl true 33 def config_change(changed, _new, removed) do 34 StatusphereWeb.Endpoint.config_change(changed, removed) 35 :ok 36 end 37 38 defp skip_migrations?() do 39 # By default, sqlite migrations are run when using a release 40 System.get_env("RELEASE_NAME") == nil 41 end 42end