Skip to content

Commit

Permalink
es github env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjyotk committed Apr 17, 2024
1 parent 401a9e9 commit 03a9339
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ cdk.out
local-packages/*
layers/*
layers/**
venv/*
venv/*
local/*
8 changes: 4 additions & 4 deletions lambdas/ImageInquiry-lf1-frmCDK/ImageInquiry-lf1-frmCDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def lambda_handler(event, context):

# Prepare for OpenSearch index
host = os.environ.get("OPENSEARCH_HOST_ENDPOINT")
esUsername = os.environ['esUsername']
esPassword = os.environ['esPassword']
logger.debug(f"OpenSearch credentials retrieved: {esUsername}")
ESUSERNAME = os.environ['ESUSERNAME']
ESPASSWORD = os.environ['ESPASSWORD']
logger.debug(f"OpenSearch credentials retrieved: {ESUSERNAME}")


if len(custom_labels) > 0:
labels.extend(custom_labels)

auth = (esUsername, esPassword)
auth = (ESUSERNAME, ESPASSWORD)
INDEX_NAME = "photo-label"
esEndPoint = os.environ["OPENSEARCH_HOST_ENDPOINT"]

Expand Down
4 changes: 2 additions & 2 deletions lambdas/ImageInquiry-lf2-frmCDK/ImageInquiry-lf2-frmCDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def get_photo_path(keys):
print(f"Host is: {host}")

auth = (
os.environ['esUsername'],
os.environ['esPassword']
os.environ['ESUSERNAME'],
os.environ['ESPASSWORD']
)


Expand Down
12 changes: 6 additions & 6 deletions lf1_image_indexing/lf1_image_indexing_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
layers=[layer1],
timeout= Duration.minutes(10),
environment={
'OPENSEARCH_HOST_ENDPOINT': 'search-photo-label-os-domain-mdmhp5yj32skks62nywaguso7i.us-east-1.es.amazonaws.com',
'esUsername': 'deepjyot',
'esPassword': 'Deep@123'
'OPENSEARCH_HOST_ENDPOINT': os.environ['OPENSEARCH_HOST_ENDPOINT'],
'ESUSERNAME': os.environ['ESUSERNAME'],
'ESPASSWORD': os.environ['ESPASSWORD'],
}
)
lambda_fn2 = lambda_.Function(self, "ImageInquiry-lf2-frmCDK",
Expand All @@ -109,9 +109,9 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
layers=[layer2],
timeout= Duration.minutes(10),
environment={
'OPENSEARCH_HOST_ENDPOINT': 'search-photo-label-os-domain-mdmhp5yj32skks62nywaguso7i.us-east-1.es.amazonaws.com',
'esUsername': 'deepjyot',
'esPassword': 'Deep@123'
'OPENSEARCH_HOST_ENDPOINT': os.environ['OPENSEARCH_HOST_ENDPOINT'],
'ESUSERNAME': os.environ['ESUSERNAME'],
'ESPASSWORD': os.environ['ESPASSWORD'],
}
)

Expand Down
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
aws-cdk-lib==2.137.0
constructs>=10.0.0,<11.0.0
constructs>=10.0.0,<11.0.0
opensearch-py==2.5.0
requests-aws4auth==1.2.3
utils==1.0.2
elasticsearch==7.13.4

0 comments on commit 03a9339

Please sign in to comment.