flip feature flag
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user