@@ -7,14 +7,28 @@ defmodule PhoenixApp.Application do
77
88 @ impl true
99 def start ( _type , _args ) do
10+ :ok = Application . ensure_started ( :inets )
11+
12+ :logger . add_handler ( :my_sentry_handler , Sentry.LoggerHandler , % {
13+ config: % { metadata: [ :file , :line ] }
14+ } )
15+
16+ OpentelemetryBandit . setup ( )
17+ OpentelemetryPhoenix . setup ( adapter: :bandit )
18+ OpentelemetryOban . setup ( )
19+ OpentelemetryEcto . setup ( [ :phoenix_app , :repo ] , db_statement: :enabled )
20+
1021 children = [
1122 PhoenixAppWeb.Telemetry ,
23+ PhoenixApp.Repo ,
24+ { Ecto.Migrator ,
25+ repos: Application . fetch_env! ( :phoenix_app , :ecto_repos ) , skip: skip_migrations? ( ) } ,
1226 { DNSCluster , query: Application . get_env ( :phoenix_app , :dns_cluster_query ) || :ignore } ,
1327 { Phoenix.PubSub , name: PhoenixApp.PubSub } ,
1428 # Start the Finch HTTP client for sending emails
1529 { Finch , name: PhoenixApp.Finch } ,
16- # Start a worker by calling: PhoenixApp.Worker.start_link(arg)
17- # {PhoenixApp.Worker, arg },
30+ # Start Oban
31+ { Oban , Application . fetch_env! ( :phoenix_app , Oban ) } ,
1832 # Start to serve requests, typically the last entry
1933 PhoenixAppWeb.Endpoint
2034 ]
@@ -25,12 +39,15 @@ defmodule PhoenixApp.Application do
2539 Supervisor . start_link ( children , opts )
2640 end
2741
28- # TODO: Uncomment if we ever move the endpoint from test/support to the phoenix_app dir
2942 # Tell Phoenix to update the endpoint configuration
3043 # whenever the application is updated.
31- # @impl true
32- # def config_change(changed, _new, removed) do
33- # PhoenixAppWeb.Endpoint.config_change(changed, removed)
34- # :ok
35- # end
44+ @ impl true
45+ def config_change ( changed , _new , removed ) do
46+ PhoenixAppWeb.Endpoint . config_change ( changed , removed )
47+ :ok
48+ end
49+
50+ defp skip_migrations? ( ) do
51+ System . get_env ( "RELEASE_NAME" ) != nil
52+ end
3653end
0 commit comments