Skip to content

Commit

Permalink
Changing sniffer health server port and making it configurable
Browse files Browse the repository at this point in the history
evyatarmeged committed Jan 18, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent dc3c0fb commit 2e50c3b
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/shared/config/config.go
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ const (
DebugDefault = false
PrometheusMetricsPortKey = "metrics-port"
PrometheusMetricsPortDefault = 2112
HealthProbesPortKey = "health-probes-port"
HealthProbesPortDefault = "57921"
TelemetryErrorsAPIKeyKey = "telemetry-errors-api-key"
TelemetryErrorsAPIKeyDefault = "d86195588a41fa03aa6711993bb1c765"
EnableTCPKey = "enable-tcp"
@@ -42,6 +44,7 @@ func init() {
viper.SetDefault(MapperApiUrlKey, MapperApiUrlDefault)
viper.SetDefault(DebugKey, DebugDefault)
viper.SetDefault(PrometheusMetricsPortKey, PrometheusMetricsPortDefault)
viper.SetDefault(HealthProbesPortKey, HealthProbesPortDefault)
viper.SetDefault(TelemetryErrorsAPIKeyKey, TelemetryErrorsAPIKeyDefault)
viper.SetDefault(EnableTCPKey, EnableTCPSnifferDefault)
viper.SetDefault(EnableSocketScannerKey, EnableSocketScannerDefault)
3 changes: 2 additions & 1 deletion src/sniffer/cmd/main.go
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ func main() {
ctrl.SetLogger(logrusr.New(logrus.StandardLogger()))

mapperClient := mapperclient.New(viper.GetString(sharedconfig.MapperApiUrlKey))
healthProbesPort := viper.GetInt(sharedconfig.HealthProbesPortKey)

healthServer := echo.New()
healthServer.HideBanner = true
@@ -77,7 +78,7 @@ func main() {
errgrp.Go(func() error {
logrus.Debug("Started health server")
defer errorreporter.AutoNotify()
return healthServer.Start(":9090")
return healthServer.Start(fmt.Sprintf(":%d", healthProbesPort))
})

logrus.Debug("Starting sniffer")

0 comments on commit 2e50c3b

Please sign in to comment.