Skip to content

Commit

Permalink
Removed property
Browse files Browse the repository at this point in the history
Signed-off-by: cs-308-2023 <[email protected]>
  • Loading branch information
ADI-ROXX committed Jan 11, 2025
1 parent a582865 commit 99809eb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
5 changes: 0 additions & 5 deletions cmd/collector/app/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var grpcServerFlagsCfg = serverFlagsConfig{
prefix: "collector.grpc-server",
tls: tlscfg.ServerFlagsConfig{
Prefix: "collector.grpc",
EnableCertReloadInterval: true,
},
}

Expand All @@ -65,7 +64,6 @@ var httpServerFlagsCfg = serverFlagsConfig{
prefix: "collector.http-server",
tls: tlscfg.ServerFlagsConfig{
Prefix: "collector.http",
EnableCertReloadInterval: true,
},
corsCfg: corscfg.Flags{
Prefix: "collector.otlp.http",
Expand All @@ -80,14 +78,12 @@ var otlpServerFlagsCfg = struct {
prefix: "collector.otlp.grpc",
tls: tlscfg.ServerFlagsConfig{
Prefix: "collector.otlp.grpc",
EnableCertReloadInterval: true,
},
},
HTTP: serverFlagsConfig{
prefix: "collector.otlp.http",
tls: tlscfg.ServerFlagsConfig{
Prefix: "collector.otlp.http",
EnableCertReloadInterval: true,
},
corsCfg: corscfg.Flags{
Prefix: "collector.otlp.http",
Expand All @@ -99,7 +95,6 @@ var zipkinServerFlagsCfg = serverFlagsConfig{
prefix: "collector.zipkin",
tls: tlscfg.ServerFlagsConfig{
Prefix: "collector.zipkin",
EnableCertReloadInterval: true,
},
corsCfg: corscfg.Flags{
Prefix: "collector.zipkin",
Expand Down
2 changes: 0 additions & 2 deletions cmd/query/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ const (

var tlsGRPCFlagsConfig = tlscfg.ServerFlagsConfig{
Prefix: "query.grpc",
EnableCertReloadInterval: true,
}

var tlsHTTPFlagsConfig = tlscfg.ServerFlagsConfig{
Prefix: "query.http",
EnableCertReloadInterval: true,
}

type UIConfig struct {
Expand Down
1 change: 0 additions & 1 deletion cmd/remote-storage/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const (

var tlsGRPCFlagsConfig = tlscfg.ServerFlagsConfig{
Prefix: "grpc",
EnableCertReloadInterval: true,
}

// Options holds configuration for remote-storage service.
Expand Down
8 changes: 3 additions & 5 deletions pkg/config/tlscfg/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type ClientFlagsConfig struct {
// ServerFlagsConfig describes which CLI flags for TLS server should be generated.
type ServerFlagsConfig struct {
Prefix string
EnableCertReloadInterval bool
}

// AddFlags adds flags for TLS to the FlagSet.
Expand All @@ -51,17 +50,16 @@ func (c ClientFlagsConfig) AddFlags(flags *flag.FlagSet) {

// AddFlags adds flags for TLS to the FlagSet.
func (c ServerFlagsConfig) AddFlags(flags *flag.FlagSet) {
c.EnableCertReloadInterval=true
flags.Bool(c.Prefix+tlsEnabled, false, "Enable TLS on the server")
flags.String(c.Prefix+tlsCert, "", "Path to a TLS Certificate file, used to identify this server to clients")
flags.String(c.Prefix+tlsKey, "", "Path to a TLS Private Key file, used to identify this server to clients")
flags.String(c.Prefix+tlsClientCA, "", "Path to a TLS CA (Certification Authority) file used to verify certificates presented by clients (if unset, all clients are permitted)")
flags.String(c.Prefix+tlsCipherSuites, "", "Comma-separated list of cipher suites for the server, values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants).")
flags.String(c.Prefix+tlsMinVersion, "", "Minimum TLS version supported (Possible values: 1.0, 1.1, 1.2, 1.3)")
flags.String(c.Prefix+tlsMaxVersion, "", "Maximum TLS version supported (Possible values: 1.0, 1.1, 1.2, 1.3)")
if c.EnableCertReloadInterval {
flags.Duration(c.Prefix+tlsReloadInterval, 0, "The duration after which the certificate will be reloaded (0s means will not be reloaded)")
}
// if c.EnableCertReloadInterval {
flags.Duration(c.Prefix+tlsReloadInterval, 0, "The duration after which the certificate will be reloaded (0s means will not be reloaded)")
// }
}

// InitFromViper creates tls.Config populated with values retrieved from Viper.
Expand Down
15 changes: 6 additions & 9 deletions pkg/config/tlscfg/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func TestServerFlags(t *testing.T) {
flagSet := &flag.FlagSet{}
flagCfg := ServerFlagsConfig{
Prefix: "prefix",
EnableCertReloadInterval: true,
}
flagCfg.AddFlags(flagSet)
command.PersistentFlags().AddGoFlagSet(flagSet)
Expand Down Expand Up @@ -132,13 +131,11 @@ func TestServerCertReloadInterval(t *testing.T) {
{
config: ServerFlagsConfig{
Prefix: "enabled",
EnableCertReloadInterval: true,
},
},
{
config: ServerFlagsConfig{
Prefix: "disabled",
EnableCertReloadInterval: false,
},
},
}
Expand All @@ -149,11 +146,11 @@ func TestServerCertReloadInterval(t *testing.T) {
"--" + test.config.Prefix + ".tls.enabled=true",
"--" + test.config.Prefix + ".tls.reload-interval=24h",
})
if !test.config.EnableCertReloadInterval {
assert.ErrorContains(t, err, "unknown flag")
} else {
require.NoError(t, err)
}
// if !test.config.EnableCertReloadInterval {
// assert.ErrorContains(t, err, "unknown flag")
// } else {
require.NoError(t, err)
// }
})
}
}
Expand Down Expand Up @@ -200,7 +197,7 @@ func TestFailedTLSFlags(t *testing.T) {
return clientConfig.InitFromViper(v)
}
} else {
serverConfig := &ServerFlagsConfig{Prefix: "prefix",EnableCertReloadInterval: true,}
serverConfig := &ServerFlagsConfig{Prefix: "prefix",}
addFlags = serverConfig.AddFlags
initFromViper = func(v *viper.Viper) (any, error) {
return serverConfig.InitFromViper(v)
Expand Down

0 comments on commit 99809eb

Please sign in to comment.