diff --git a/lambda_function/config.py b/lambda_function/config.py index 8917f4d..b1566b8 100644 --- a/lambda_function/config.py +++ b/lambda_function/config.py @@ -106,12 +106,71 @@ def __init__(self, REQUEST_ORIGIN: str, REQUEST_PATH: str, ID: str = None): "VPC_ID": "vpc-0e58c4d6976fb2aac", }, }, + "VEASE": { + "MASTER": { + "API_URL": "https://api.geode-solutions.com", + "ASSIGN_PUBLIC_IP": "ENABLED", + "CLUSTER_NAME": "Vease-Master", + "ENVIRONMENT_VARIABLES": { + "name": "geode", + "environment": [{"name": "ID", "value": ID}], + }, + "HEALTHCHECK_PORT": 443, + "HEALTHCHECK_ROUTE": f"/{ID}/geode/vease_back/healthcheck", + "LISTENER_ARN": "arn:aws:elasticloadbalancing:eu-west-3:622060531233:listener/app/ApiGeodeSolutions/4a4814e5912d42aa/70716e78eabafa1f", + "PING_ROUTE": f"/{ID}/geode/opengeodeweb_back/ping", + "ORIGINS": "https://vease.geode-solutions.com", + "SECONDS_BETWEEN_TRIES": 0.25, + "SECURITY_GROUP": "sg-0352ea112857ae7b9", + "SUBNET_ID": "subnet-0882d674b17515f6a", + "TASK_DEF_NAME": "Vease-Master", + "VPC_ID": "vpc-0e58c4d6976fb2aac", + }, + "NEXT": { + "API_URL": "https://api.geode-solutions.com", + "ASSIGN_PUBLIC_IP": "ENABLED", + "CLUSTER_NAME": "Vease-Next", + "ENVIRONMENT_VARIABLES": { + "name": "geode", + "environment": [{"name": "ID", "value": ID}], + }, + "HEALTHCHECK_PORT": 443, + "HEALTHCHECK_ROUTE": f"/{ID}/geode/vease_back/healthcheck", + "LISTENER_ARN": "arn:aws:elasticloadbalancing:eu-west-3:622060531233:listener/app/ApiGeodeSolutions/4a4814e5912d42aa/70716e78eabafa1f", + "PING_ROUTE": f"/{ID}/geode/opengeodeweb_back/ping", + "ORIGINS": "https://next.vease.geode-solutions.com", + "SECONDS_BETWEEN_TRIES": 0.25, + "SECURITY_GROUP": "sg-0352ea112857ae7b9", + "SUBNET_ID": "subnet-0882d674b17515f6a", + "TASK_DEF_NAME": "Vease-Next", + "VPC_ID": "vpc-0e58c4d6976fb2aac", + }, + "TEST": { + "API_URL": "https://api.geode-solutions.com", + "ASSIGN_PUBLIC_IP": "ENABLED", + "CLUSTER_NAME": "Vease-Test", + "ENVIRONMENT_VARIABLES": { + "name": "geode", + "environment": [{"name": "ID", "value": ID}], + }, + "HEALTHCHECK_PORT": 443, + "HEALTHCHECK_ROUTE": f"/{ID}/geode/vease_back/healthcheck", + "LISTENER_ARN": "arn:aws:elasticloadbalancing:eu-west-3:622060531233:listener/app/ApiGeodeSolutions/4a4814e5912d42aa/70716e78eabafa1f", + "ORIGINS": "TO_COMPLETE", + "PING_ROUTE": f"/{ID}/geode/opengeodeweb_back/ping", + "SECONDS_BETWEEN_TRIES": 0.25, + "SECURITY_GROUP": "sg-0352ea112857ae7b9", + "SUBNET_ID": "subnet-0882d674b17515f6a", + "TASK_DEF_NAME": "TO_COMPLETE", + "VPC_ID": "vpc-0e58c4d6976fb2aac", + }, + }, } if "/website/" in REQUEST_PATH: CONFIG_TYPE = "WEBSITE" if REQUEST_ORIGIN == "": - CONFIG_TYPE = "NEXT" + CONFIG_ENV = "NEXT" elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["MASTER"]["ORIGINS"]: CONFIG_ENV = "MASTER" elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["NEXT"]["ORIGINS"]: @@ -124,11 +183,24 @@ def __init__(self, REQUEST_ORIGIN: str, REQUEST_PATH: str, ID: str = None): elif "/sharetwin/" in REQUEST_PATH: CONFIG_TYPE = "SHARETWIN" if REQUEST_ORIGIN == "": - CONFIG_TYPE = "NEXT" + CONFIG_ENV = "NEXT" elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["MASTER"]["ORIGINS"]: CONFIG_ENV = "MASTER" elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["NEXT"]["ORIGINS"]: CONFIG_ENV = "NEXT" + elif "/vease/" in REQUEST_PATH: + CONFIG_TYPE = "VEASE" + if REQUEST_ORIGIN == "": + CONFIG_ENV = "NEXT" + elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["MASTER"]["ORIGINS"]: + CONFIG_ENV = "MASTER" + elif REQUEST_ORIGIN == CONFIG_DICT[CONFIG_TYPE]["NEXT"]["ORIGINS"]: + CONFIG_ENV = "NEXT" + elif "--geode-solutions.netlify.app" in REQUEST_ORIGIN: + CONFIG_ENV = "TEST" + task = REQUEST_ORIGIN[8:].split("--geode-solutions.netlify.app")[0] + CONFIG_DICT[CONFIG_TYPE][CONFIG_ENV]["ORIGINS"] = REQUEST_ORIGIN + CONFIG_DICT[CONFIG_TYPE][CONFIG_ENV]["TASK_DEF_NAME"] = task self.API_URL = CONFIG_DICT[CONFIG_TYPE][CONFIG_ENV]["API_URL"] self.ASSIGN_PUBLIC_IP = CONFIG_DICT[CONFIG_TYPE][CONFIG_ENV]["ASSIGN_PUBLIC_IP"]