Skip to content

Commit

Permalink
Merge pull request #563 from jmpsec/better-info-api-start
Browse files Browse the repository at this point in the history
Better info messages starting osctrl-api
  • Loading branch information
javuto authored Nov 7, 2024
2 parents 621ec8a + 1df242f commit 1f093f5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,7 @@ func osctrlAPIService() {
// Ticker to reload environments
// FIXME Implement Redis cache
// FIXME splay this?
if settingsmgr.DebugService(settings.ServiceAPI) {
log.Debug().Msg("DebugService: Environments ticker")
}
log.Info().Msg("Initialize environments refresh")
// Refresh environments as soon as service starts
go func() {
_t := settingsmgr.RefreshEnvs(settings.ServiceAPI)
Expand All @@ -513,10 +511,8 @@ func osctrlAPIService() {
// Ticker to reload settings
// FIXME Implement Redis cache
// FIXME splay this?
if settingsmgr.DebugService(settings.ServiceAPI) {
log.Debug().Msg("DebugService: Settings ticker")
}
// Refresh settings as soon as the service starts
log.Info().Msg("Initialize settings refresh")
go func() {
_t := settingsmgr.RefreshSettings(settings.ServiceAPI)
if _t == 0 {
Expand All @@ -527,8 +523,8 @@ func osctrlAPIService() {
time.Sleep(time.Duration(_t) * time.Second)
}
}()

// Initialize Admin handlers before router
log.Info().Msg("Initializing handlers")
handlersApi = handlers.CreateHandlersApi(
handlers.WithDB(db.Conn),
handlers.WithEnvs(envs),
Expand All @@ -545,9 +541,7 @@ func osctrlAPIService() {
)

// ///////////////////////// API
if settingsmgr.DebugService(settings.ServiceAPI) {
log.Debug().Msg("DebugService: Creating router")
}
log.Info().Msg("Initializing router")
// Create router for API endpoint
muxAPI := http.NewServeMux()
// API: root
Expand Down

0 comments on commit 1f093f5

Please sign in to comment.