diff --git a/cmd/queryService/main.go b/cmd/queryService/main.go index 21f2c01f..7ac9a04b 100644 --- a/cmd/queryService/main.go +++ b/cmd/queryService/main.go @@ -95,14 +95,18 @@ func main() { return swagger, nil } - // this must be done before the rbac.InitializeAuthProvider + // Both of these operations (InitializeConfig and InitializeAuthProvider) + // would be better off in the service.new but there are temporal dependencies + // that make this not possible right now without more refactoring. + + // This must be done before the rbac.InitializeAuthProvider errInitializingConfig := serviceconfig.InitializeConfig(cfg) if errInitializingConfig != nil { slog.Error(errInitializingConfig.Error()) os.Exit(1) } - // initialize the rbac config here since only the API service needs it + // Initialize the rbac config here since only the API service needs it errorGettingAuthProvider := rbac.InitializeAuthProvider(&cfg.AuthConfig) if errorGettingAuthProvider != nil { slog.Error(errorGettingAuthProvider.Error()) diff --git a/internal/serviceconfig/rbac/config.go b/internal/serviceconfig/rbac/config.go index 287622c6..bcc35090 100644 --- a/internal/serviceconfig/rbac/config.go +++ b/internal/serviceconfig/rbac/config.go @@ -9,13 +9,14 @@ import ( // AuthConfig holds the RBAC configuration and KeyProvider type AuthConfig struct { - AuthType string `env:"RBAC_PROVIDER" envDefault:"cognito"` + // cognito or local + AuthType string `env:"RBAC_PROVIDER" envDefault:"local"` // Cognito Config CognitoRegion string `env:"COGNITO_REGION" envDefault:"us-east-1"` CognitoUserPoolID string `env:"COGNITO_USER_POOL_ID"` // Local Key Config - PrivateKeyPath string `env:"RBAC_PRIVATE_KEY_PATH"` - PublicKeyPath string `env:"RBAC_PUBLIC_KEY_PATH"` + PrivateKeyPath string `env:"RBAC_PRIVATE_KEY_PATH" envDefault:"./public_key.pem"` + PublicKeyPath string `env:"RBAC_PUBLIC_KEY_PATH" envDefault:"./private_key.pem"` // Actual provider - can be either local or cognito AuthProvider rbac.KeyProvider