application.ex 970 B

1234567891011121314151617181920212223242526272829303132333435
  1. defmodule Toy.Application do
  2. # See https://hexdocs.pm/elixir/Application.html
  3. # for more information on OTP Applications
  4. @moduledoc false
  5. use Application
  6. @impl true
  7. def start(_type, _args) do
  8. children = [
  9. Toy.Features,
  10. # Start the Telemetry supervisor
  11. ToyWeb.Telemetry,
  12. # Start the PubSub system
  13. {Phoenix.PubSub, name: Toy.PubSub},
  14. # Start the Endpoint (http/https)
  15. ToyWeb.Endpoint
  16. # Start a worker by calling: Toy.Worker.start_link(arg)
  17. # {Toy.Worker, arg}
  18. ]
  19. # See https://hexdocs.pm/elixir/Supervisor.html
  20. # for other strategies and supported options
  21. opts = [strategy: :one_for_one, name: Toy.Supervisor]
  22. Supervisor.start_link(children, opts)
  23. end
  24. # Tell Phoenix to update the endpoint configuration
  25. # whenever the application is updated.
  26. @impl true
  27. def config_change(changed, _new, removed) do
  28. ToyWeb.Endpoint.config_change(changed, removed)
  29. :ok
  30. end
  31. end