flip feature flag

This commit is contained in:
jay brown
2025-04-14 15:40:01 -07:00
parent a50d935c33
commit 5aff28d1b6
3 changed files with 5 additions and 9 deletions
+2 -7
View File
@@ -17,16 +17,11 @@ import (
// RegisterRoutes registers all authentication-related routes to the Echo engine
func RegisterRoutes(e *echo.Echo, config auth.ConfigProvider) {
// check the auth feature flag
enableAuth := os.Getenv("ENABLE_AUTH")
if enableAuth == "" || strings.ToLower(enableAuth) == "false" {
disableAuth := os.Getenv("DISABLE_AUTH")
if strings.ToLower(disableAuth) == "true" {
return // Do nothing if auth is not enabled
}
// Only proceed if ENABLE_AUTH is "true" or "auth"
if strings.ToLower(enableAuth) != "true" {
return
}
// Register the login route - the middleware will handle this
e.GET(config.GetAuthLoginPath(), func(c echo.Context) error {
// This is handled by the middleware
+2 -2
View File
@@ -13,8 +13,8 @@ A reusable Go package for AWS Cognito authentication and authorization with Echo
- Simple integration with Echo framework
## Feature flag for Auth
To enable all of these features for all endpoints you must set
`ENABLE_AUTH=true` in your environment.
To disable all of these features for all endpoints you must set
`DISABLE_AUTH=true` in your environment.
## Installation
+1
View File
@@ -49,6 +49,7 @@ func createContainer(t testing.TB, ctx context.Context, cfg *containerConfig) (t
"AWS_ENDPOINT_URL_S3": cfg.Cfg.GetAWSEndpoint(),
"AWS_ENDPOINT_URL_TEXTRACT": cfg.MockHTTP,
"AWS_S3_USE_PATH_STYLE": strconv.FormatBool(true),
"DISABLE_AUTH": "true",
"LOG_LEVEL": "DEBUG",
"COGNITO_USER_POOL_ID": "coguserpoolid",
"COGNITO_CLIENT_SECRET": "cogsecret",