fix tests

This commit is contained in:
jay brown
2025-03-18 16:28:00 -07:00
parent 78a0cea7b7
commit 64141529e8
2 changed files with 10 additions and 5 deletions
+6 -2
View File
@@ -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())
+4 -3
View File
@@ -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