-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
63 lines (53 loc) · 1.52 KB
/
app.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
60
61
62
63
#!/usr/bin/env python3
import logging
import os
import aws_cdk as cdk
from dotenv import dotenv_values
from common import Config
from common.shared_cdk_stack import SharedStack
from season_pass.api_cdk_stack import APIStack
from worker.worker_cdk_stack import WorkerStack
stage = os.environ.get("STAGE", "development")
if os.path.exists(f".env.{stage}"):
env_values = dotenv_values(f".env.{stage}")
if stage != env_values["STAGE"]:
logging.error(f"Provided stage {stage} is not identical with STAGE in env: {env_values['STAGE']}")
exit(1)
else:
env_values = os.environ
config = Config(**{k.lower(): v for k, v in env_values.items()})
TAGS = {
"Name": f"9c-season_pass-{stage}",
"Environment": "production" if stage == "mainnet" else "development",
"Service": "NineChronicles.SeasonPass",
"Team": "game",
"Owner": "hyeon",
}
app = cdk.App()
shared = SharedStack(
app, f"{config.stage}-9c-season-pass-SharedStack",
env=cdk.Environment(
account=config.account_id, region=config.region_name,
),
config=config,
tags=TAGS,
)
APIStack(
app, f"{config.stage}-9c-season-pass-APIStack",
env=cdk.Environment(
account=config.account_id, region=config.region_name,
),
config=config,
shared_stack=shared,
tags=TAGS,
)
WorkerStack(
app, f"{config.stage}-9c-season-pass-WorkerStack",
env=cdk.Environment(
account=config.account_id, region=config.region_name,
),
config=config,
shared_stack=shared,
tags=TAGS,
)
app.synth()