Skip to content

Commit

Permalink
Add default command config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Oct 8, 2024
1 parent 2350656 commit 21d1004
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const (
DefCollectorTLSCAPath = "/var/lib/nginx-agent/ca.pem"
DefCollectorTLSSANNames = "127.0.0.1,::1,localhost"

DefCommandServerHostKey = "127.0.0.1"
DefCommandServerPortKey = 8080
DefCommandServerHostKey = ""
DefCommandServerPortKey = 0
DefCommandServerTypeKey = "grpc"
DefCommandAuthTokenKey = ""
DefCommandTLSCertKey = ""
Expand Down
2 changes: 1 addition & 1 deletion internal/datasource/host/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (i *Info) HostInfo(ctx context.Context) *v1.Resource_HostInfo {
func containsContainerReference(cgroupFile string) bool {
data, err := os.ReadFile(cgroupFile)
if err != nil {
slog.Error("Unable to check if cgroup file contains a container reference", "error", err)
slog.Warn("Unable to check if cgroup file contains a container reference", "error", err)
return false
}

Expand Down
5 changes: 5 additions & 0 deletions internal/plugin/plugin_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func addCommandAndFilePlugins(ctx context.Context, plugins []bus.Plugin, agentCo
filePlugin := file.NewFilePlugin(agentConfig, grpcConnection)
plugins = append(plugins, filePlugin)
}
} else {
slog.InfoContext(ctx, "Agent is not connected to a management plane. "+
"Configure a command server to establish a connection with a management plane.")
}

return plugins
Expand Down Expand Up @@ -77,5 +80,7 @@ func addWatcherPlugin(plugins []bus.Plugin, agentConfig *config.Config) []bus.Pl
func isGrpcClientConfigured(agentConfig *config.Config) bool {
return agentConfig.Command != nil &&
agentConfig.Command.Server != nil &&
agentConfig.Command.Server.Host != "" &&
agentConfig.Command.Server.Port != 0 &&
agentConfig.Command.Server.Type == config.Grpc
}

0 comments on commit 21d1004

Please sign in to comment.