Skip to content

Commit

Permalink
PTEUDO-1247 Refactor per-request parameters to be requestInfo struct
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrorichardtoledo authored Sep 16, 2024
1 parent 0eaa563 commit a441210
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 293 deletions.
16 changes: 6 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func main() {
"If set, HTTP/2 will be enabled for the metrics and webhook servers")

var class string
var dbIdentifierPrefix string
var configFile string
var dsnExecSidecarConfigPath string
var metricsDepYamlPath string
Expand All @@ -100,7 +99,6 @@ func main() {
var enableDSNExecWebhook bool

flag.StringVar(&class, "class", "default", "The class of claims this db-controller instance needs to address.")
flag.StringVar(&dbIdentifierPrefix, "db-identifier-prefix", "", "The prefix to be added to the DbHost. Ideally this is the env name.")

flag.StringVar(&configFile, "config-file", "/etc/config/config.yaml", "Database connection string to with root credentials.")
flag.StringVar(&dsnExecSidecarConfigPath, "dsnexec-sidecar-config-path", "/etc/config/dsnexec/dsnexecsidecar.json", "Mutating webhook sidecar configuration.")
Expand Down Expand Up @@ -195,10 +193,9 @@ func main() {
}

dbClaimConfig := &databaseclaim.DatabaseClaimConfig{
Viper: ctlConfig,
Namespace: namespace,
Class: class,
DbIdentifierPrefix: dbIdentifierPrefix,
Viper: ctlConfig,
Namespace: namespace,
Class: class,
// Log: ctrl.Log.WithName("controllers").WithName("DatabaseClaim").V(controllers.InfoLevel),
MasterAuth: rdsauth.NewMasterAuth(),
MetricsEnabled: true,
Expand All @@ -216,10 +213,9 @@ func main() {
os.Exit(1)
}
dbRoleClaimConfig := &roleclaim.RoleConfig{
Viper: ctlConfig,
Namespace: namespace,
Class: class,
DbIdentifierPrefix: dbIdentifierPrefix,
Viper: ctlConfig,
Namespace: namespace,
Class: class,
// Log: ctrl.Log.WithName("controllers").WithName("DatabaseClaim").V(controllers.InfoLevel),
MasterAuth: rdsauth.NewMasterAuth(),
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/basefunctions/basefunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,8 @@ func GetDynamicHostWaitTime(viperConfig *viper.Viper) time.Duration {

return t
}

// GetDBIdentifierPrefix returns the prefix for the database identifier.
func GetDBIdentifierPrefix(viperConfig *viper.Viper) string {
return viperConfig.GetString("dbIdentifierPrefix")
}
Loading

0 comments on commit a441210

Please sign in to comment.