diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3276bf4bc..daf43976f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,6 +27,7 @@ env: DEV_VITE_GA_ID: ${{secrets.DEV_VITE_GA_ID}} UID: ${{secrets.UID}} OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}} + TEST_USER: ${{secrets.TEST_USER}} STAGE: dev jobs: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4f24a8856..4b61a4abf 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -34,6 +34,7 @@ env: DEV_VITE_GA_ID: ${{secrets.DEV_VITE_GA_ID}} UID: ${{secrets.UID}} OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}} + TEST_USER: ${{secrets.TEST_USER}} STAGE: dev jobs: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ee046c40b..0c7a608e3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,6 +31,7 @@ env: MASTER_VITE_GA_ID: ${{secrets.VITE_GA_ID}} DEV_VITE_GA_ID: ${{secrets.DEV_VITE_GA_ID}} OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}} + TEST_USER: ${{secrets.TEST_USER}} STAGE: dev jobs: diff --git a/lib/configs/lambda/environment.ts b/lib/configs/lambda/environment.ts index 8128e15e7..1fa410672 100644 --- a/lib/configs/lambda/environment.ts +++ b/lib/configs/lambda/environment.ts @@ -6,3 +6,5 @@ export const SLACK_WEBHOOK_URL = process.env.SLACK_WEBHOOK_URL!; export const AWS_USER_POOL_ID = process.env.AWS_USER_POOL_ID!; export const OPENAI_API_KEY = process.env.OPENAI_API_KEY!; + +export const TEST_USER = process.env.TEST_USER!; diff --git a/lib/constructs/common/lambda-functions.ts b/lib/constructs/common/lambda-functions.ts index 01de8ecf1..e3acab970 100644 --- a/lib/constructs/common/lambda-functions.ts +++ b/lib/constructs/common/lambda-functions.ts @@ -12,6 +12,7 @@ import { SLACK_WEBHOOK_URL, AWS_USER_POOL_ID, OPENAI_API_KEY, + TEST_USER, } from '../../configs/lambda/environment'; interface FunctionsProps { @@ -227,7 +228,7 @@ export class PreSignupWasedaMailValidator extends Construct { memorySize: 128, runtime: lambda.Runtime.PYTHON_3_9, timeout: Duration.seconds(3), - }); + }).addEnvironment('TEST_USER', TEST_USER); } } diff --git a/src/lambda/signup-validator/index.py b/src/lambda/signup-validator/index.py index 04592eefe..70bbed0de 100644 --- a/src/lambda/signup-validator/index.py +++ b/src/lambda/signup-validator/index.py @@ -1,9 +1,12 @@ +from utils import test_user + + def handler(event, context): email = event["request"]["userAttributes"]["email"] domain = email.split('@')[1] # Check for the specific test email address - if email == "t56299097@gmail.com": + if email == test_user: event["response"]["autoConfirmUser"] = True return event diff --git a/src/lambda/signup-validator/utils.py b/src/lambda/signup-validator/utils.py new file mode 100644 index 000000000..f081a5b45 --- /dev/null +++ b/src/lambda/signup-validator/utils.py @@ -0,0 +1,3 @@ +import os + +test_user = os.getenv('TEST_USER')