Skip to content

Commit

Permalink
fix: correct check for CDK_STACK_CONFIG
Browse files Browse the repository at this point in the history
  • Loading branch information
danellecline committed May 17, 2024
1 parent a914349 commit d2c062d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cdk/cdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
'''
import datetime as dt
import yaml
import os
from fastapi import FastAPIStack
from aws_cdk import (
App, Environment
)

app = App()

# Import project config
with open("config.yml", 'r') as stream:
# Import project config from CDK_STACK_CONFIG environment variable
if 'CDK_STACK_CONFIG' not in os.environ:
raise ValueError("CDK_STACK_CONFIG environment variable not set")

with open(os.environ['CDK_STACK_CONFIG'], 'r') as stream:
config = yaml.safe_load(stream)

deletion_date = (dt.datetime.utcnow() + dt.timedelta(days=90)).strftime('%Y%m%dT%H%M%SZ')
Expand Down
8 changes: 6 additions & 2 deletions cdk/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'''

import yaml
import os
from aws_cdk import Stack
from constructs import Construct
from aws_cdk import (
Expand All @@ -36,8 +37,11 @@ def __init__(
) -> None:
super().__init__(scope, id, **kwargs)

# Import project config
with open(process.env.CDK_STACK_CONFIG, 'r') as stream:
# Import project config from CDK_STACK_CONFIG environment variable
if 'CDK_STACK_CONFIG' not in os.environ:
raise ValueError("CDK_STACK_CONFIG environment variable not set")

with open(os.environ['CDK_STACK_CONFIG'], 'r') as stream:
config = yaml.safe_load(stream)

# Cluster capacity
Expand Down

0 comments on commit d2c062d

Please sign in to comment.