From 5aff28d1b6f8661b107b49bd4da4dee84556ca0a Mon Sep 17 00:00:00 2001 From: jay brown Date: Mon, 14 Apr 2025 15:40:01 -0700 Subject: [PATCH] flip feature flag --- internal/cognitoauth/auth.go | 9 ++------- internal/cognitoauth/readme.md | 4 ++-- internal/test/container.go | 1 + 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/cognitoauth/auth.go b/internal/cognitoauth/auth.go index ca54bfca..96ae60ad 100644 --- a/internal/cognitoauth/auth.go +++ b/internal/cognitoauth/auth.go @@ -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 diff --git a/internal/cognitoauth/readme.md b/internal/cognitoauth/readme.md index 74b21ac5..f0c4b410 100644 --- a/internal/cognitoauth/readme.md +++ b/internal/cognitoauth/readme.md @@ -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 diff --git a/internal/test/container.go b/internal/test/container.go index 973d6b55..5d2328b9 100644 --- a/internal/test/container.go +++ b/internal/test/container.go @@ -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",