cloudflared was started without any flags
(c *cli.Context, shutdownC chan struct{})
| 196 | |
| 197 | // cloudflared was started without any flags |
| 198 | func handleServiceMode(c *cli.Context, shutdownC chan struct{}) error { |
| 199 | log := logger.CreateLoggerFromContext(c, logger.DisableTerminalLog) |
| 200 | |
| 201 | // start the main run loop that reads from the config file |
| 202 | f, err := watcher.NewFile() |
| 203 | if err != nil { |
| 204 | log.Err(err).Msg("Cannot load config file") |
| 205 | return err |
| 206 | } |
| 207 | |
| 208 | configPath := config.FindOrCreateConfigPath() |
| 209 | configManager, err := config.NewFileManager(f, configPath, log) |
| 210 | if err != nil { |
| 211 | log.Err(err).Msg("Cannot setup config file for monitoring") |
| 212 | return err |
| 213 | } |
| 214 | log.Info().Msgf("monitoring config file at: %s", configPath) |
| 215 | |
| 216 | serviceCallback := func(t string, name string, err error) { |
| 217 | if err != nil { |
| 218 | log.Err(err).Msgf("%s service: %s encountered an error", t, name) |
| 219 | } |
| 220 | } |
| 221 | serviceManager := overwatch.NewAppManager(serviceCallback) |
| 222 | |
| 223 | appService := NewAppService(configManager, serviceManager, shutdownC, log) |
| 224 | if err := appService.Run(); err != nil { |
| 225 | log.Err(err).Msg("Failed to start app service") |
| 226 | return err |
| 227 | } |
| 228 | return nil |
| 229 | } |
no test coverage detected