Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/admin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ const (
projectName string = "osctrl"
// Service name
serviceName string = projectName + "-" + config.ServiceAdmin
// Service version
serviceVersion string = version.OsctrlVersion
// Service description
serviceDescription string = "Admin service for osctrl"
// Application description
Expand Down Expand Up @@ -75,7 +73,7 @@ const (

// Build-time metadata (overridden via -ldflags "-X main.buildVersion=... -X main.buildCommit=... -X main.buildDate=...")
var (
buildVersion = serviceVersion
buildVersion = version.OsctrlVersion
buildCommit = "unknown"
buildDate = "unknown"
)
Expand Down Expand Up @@ -304,7 +302,7 @@ func osctrlAdminService() {
handlers.WithSettings(settingsmgr),
handlers.WithCache(redis),
handlers.WithSessions(sessionsmgr),
handlers.WithVersion(serviceVersion),
handlers.WithVersion(buildVersion),
handlers.WithOsqueryVersion(flagParams.OsqueryVersion),
handlers.WithTemplates(flagParams.TemplatesDir),
handlers.WithStaticLocation(flagParams.StaticOffline),
Expand Down Expand Up @@ -555,12 +553,14 @@ func osctrlAdminService() {
TLSConfig: cfg,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
}
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := srv.ListenAndServeTLS(flagParams.TLSCertFile, flagParams.TLSKeyFile); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
}
} else {
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := http.ListenAndServe(serviceListener, adminMux); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const (
projectName = "osctrl"
// Service name
serviceName = projectName + "-" + config.ServiceAPI
// Service version
serviceVersion = version.OsctrlVersion
// Service description
serviceDescription = "API service for osctrl"
// Application description
Expand All @@ -47,7 +45,7 @@ const (

// Build-time metadata (overridden via -ldflags "-X main.buildVersion=... -X main.buildCommit=... -X main.buildDate=...")
var (
buildVersion = serviceVersion
buildVersion = version.OsctrlVersion
buildCommit = "unknown"
buildDate = "unknown"
)
Expand Down Expand Up @@ -207,7 +205,7 @@ func osctrlAPIService() {
handlers.WithCarves(filecarves),
handlers.WithSettings(settingsmgr),
handlers.WithCache(redis),
handlers.WithVersion(serviceVersion),
handlers.WithVersion(buildVersion),
handlers.WithName(serviceName),
handlers.WithDebugHTTP(&flagParams.DebugHTTPValues),
)
Expand Down Expand Up @@ -376,12 +374,14 @@ func osctrlAPIService() {
TLSConfig: cfg,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
}
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := srv.ListenAndServeTLS(flagParams.TLSCertFile, flagParams.TLSKeyFile); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
}
} else {
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := http.ListenAndServe(serviceListener, muxAPI); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message mentions 'ListenAndServeTLS' but this code path is for HTTP (not HTTPS) listening. The message should be 'ListenAndServe' to match the actual function being called.

Suggested change
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
log.Fatal().Msgf("ListenAndServe: %v", err)

Copilot uses AI. Check for mistakes.
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/tls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const (
projectName string = "osctrl"
// Service name
serviceName string = projectName + "-" + config.ServiceTLS
// Service version
serviceVersion string = version.OsctrlVersion
// Service description
serviceDescription string = "TLS service for osctrl"
// Application description
Expand All @@ -55,7 +53,7 @@ const (

// Build-time metadata (overridden via -ldflags "-X main.buildVersion=... -X main.buildCommit=... -X main.buildDate=...")
var (
buildVersion = serviceVersion
buildVersion = version.OsctrlVersion
buildCommit = "unknown"
buildDate = "unknown"
)
Expand Down Expand Up @@ -334,12 +332,14 @@ func osctrlService() {
TLSConfig: cfg,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
}
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTPS listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := srv.ListenAndServeTLS(flagParams.TLSCertFile, flagParams.TLSKeyFile); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
}
} else {
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, serviceVersion, serviceListener)
log.Info().Msgf("%s v%s - HTTP listening %s", serviceName, buildVersion, serviceListener)
log.Info().Msgf("%s - commit=%s - build date=%s", serviceName, buildCommit, buildDate)
if err := http.ListenAndServe(serviceListener, muxTLS); err != nil {
log.Fatal().Msgf("ListenAndServeTLS: %v", err)
}
Expand Down
Loading