-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.py
59 lines (43 loc) · 1.64 KB
/
configure.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import json
from aws_cdk import (
core,
aws_lambda
)
from utils import load_config,save_config, load_personalize_resources
config = load_config('project_config.json')
STACK_NAME = config['STACK_NAME']
TAGS = config['RESOURCE_TAGS']
REGION = config['REGION']
USE_ACCOUNT_PERSONALIZE_RESOURCES = config['USE_ACCOUNT_PERSONALIZE_RESOURCES']
if USE_ACCOUNT_PERSONALIZE_RESOURCES:
ACCOUNT_RESOURCES = load_personalize_resources(REGION)
ACCOUNT_RESOURCES_REAL = ACCOUNT_RESOURCES['REAL_DATA']
ACCOUNT_RESOURCES_ANON = ACCOUNT_RESOURCES['ANON_DATA']
config['APIS'] = ACCOUNT_RESOURCES_ANON['APIS']
config['EVENT_TRACKERS'] = ACCOUNT_RESOURCES_ANON['EVENT_TRACKERS']
config['FILTERS'] = ACCOUNT_RESOURCES_ANON['FILTERS']
save_config(config, 'project_config.json')
APIS = ACCOUNT_RESOURCES_REAL['APIS']
EVENT_TRACKERS = ACCOUNT_RESOURCES_REAL['EVENT_TRACKERS']
FILTERS = ACCOUNT_RESOURCES_REAL['FILTERS']
BASE_LAMBDA_CONFIG = dict (
timeout=core.Duration.seconds(20),
memory_size=256,
tracing= aws_lambda.Tracing.ACTIVE)
PYTHON_LAMBDA_CONFIG = dict (runtime=aws_lambda.Runtime.PYTHON_3_8, **BASE_LAMBDA_CONFIG)
BASE_ENV_VARIABLES = dict (REGION= REGION, FILTERS = json.dumps(FILTERS))
BASE_INTEGRATION_CONFIG = dict(proxy=True,
integration_responses=[{
'statusCode': '200',
'responseParameters': {
'method.response.header.Access-Control-Allow-Origin': "'*'"
}
}])
BASE_METHOD_RESPONSE = dict(
method_responses=[{
'statusCode': '200',
'responseParameters': {
'method.response.header.Access-Control-Allow-Origin': True,
}
}]
)