Skip to content

Commit

Permalink
Don't use a pointer for HealthCheckConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
  • Loading branch information
keeganwitt committed Dec 17, 2024
1 parent d8ff964 commit 1640761
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions cmd/spiffe-helper/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ const (
)

type Config struct {
AddIntermediatesToBundle bool `hcl:"add_intermediates_to_bundle"`
AgentAddress string `hcl:"agent_address"`
Cmd string `hcl:"cmd"`
CmdArgs string `hcl:"cmd_args"`
PIDFileName string `hcl:"pid_file_name"`
CertDir string `hcl:"cert_dir"`
CertFileMode int `hcl:"cert_file_mode"`
KeyFileMode int `hcl:"key_file_mode"`
JWTBundleFileMode int `hcl:"jwt_bundle_file_mode"`
JWTSVIDFileMode int `hcl:"jwt_svid_file_mode"`
IncludeFederatedDomains bool `hcl:"include_federated_domains"`
RenewSignal string `hcl:"renew_signal"`
DaemonMode *bool `hcl:"daemon_mode"`
HealthCheck *HealthCheckConfig `hcl:"health_checks"`
AddIntermediatesToBundle bool `hcl:"add_intermediates_to_bundle"`
AgentAddress string `hcl:"agent_address"`
Cmd string `hcl:"cmd"`
CmdArgs string `hcl:"cmd_args"`
PIDFileName string `hcl:"pid_file_name"`
CertDir string `hcl:"cert_dir"`
CertFileMode int `hcl:"cert_file_mode"`
KeyFileMode int `hcl:"key_file_mode"`
JWTBundleFileMode int `hcl:"jwt_bundle_file_mode"`
JWTSVIDFileMode int `hcl:"jwt_svid_file_mode"`
IncludeFederatedDomains bool `hcl:"include_federated_domains"`
RenewSignal string `hcl:"renew_signal"`
DaemonMode *bool `hcl:"daemon_mode"`
HealthCheck HealthCheckConfig `hcl:"health_checks"`

// x509 configuration
SVIDFileName string `hcl:"svid_file_name"`
Expand Down Expand Up @@ -168,12 +168,12 @@ func (c *Config) ValidateConfig(log logrus.FieldLogger) error {
c.JWTSVIDFileMode = defaultJWTSVIDFileMode
}

if c.HealthCheck != nil && c.HealthCheck.BindPort < 0 {
if c.HealthCheck.ListenerEnabled && c.HealthCheck.BindPort < 0 {
return errors.New("bind port must be positive")
} else if c.HealthCheck != nil && c.HealthCheck.BindPort == 0 {
} else if c.HealthCheck.ListenerEnabled && c.HealthCheck.BindPort == 0 {
c.HealthCheck.BindPort = defaultBindPort
}
if c.HealthCheck != nil && c.HealthCheck.HealthPath == "" {
if c.HealthCheck.ListenerEnabled && c.HealthCheck.HealthPath == "" {
c.HealthCheck.HealthPath = defaultHealthPath
}

Expand Down

0 comments on commit 1640761

Please sign in to comment.