-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCRUM-14-POST-attandces #26
base: dev
Are you sure you want to change the base?
Conversation
…ambda function for confirm attendance
@Rich627 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗨 @Rich627 ,一個 Lambda 就要給他一個目錄喔
例如: campaign_service/create_campaign,然後該目錄裡面會放 lambda_function.py
, Dockerfile
, requirements.txt
... 等等
src/campaign/s3.py
Outdated
import boto3 | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你有使用到 .env,這樣你會把機敏資料放在 Docker Image 內唷
我認為更安全且更方便共享 configuration 的方式:
- 建議放在 Lambda Environment Variables
- 若有機敏資料不能 hard code 在 configuration 上,則放在 Secret Manager 或是 Parameter Store 加密,在程式碼裡面用 SDK 呼叫去拿
除此之外,若有使用 .env
,要記得寫一個 .env.example
用來告知團隊其他成員你配置了什麼
Terraform Apply Results 🌟Preview environment has been deployed. You can now test your changes. Show Actual Apply
Pushed by: @Rich627, Action: |
… and fixed typo (SCRUM-14)
…ws-educate-tpet-backend into SCRUM-14-POST-attandces
@@ -0,0 +1 @@ | |||
python-dotenv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需檢查是否還有需要用到 python-dotenv
若確定後面沒有要用到,需要移除
def list_files(self, bucket_name: str): | ||
""" | ||
List all files in an S3 bucket | ||
""" | ||
try: | ||
response = self.s3_client.list_objects_v2(Bucket=bucket_name) | ||
if 'Contents' in response: | ||
return [obj['Key'] for obj in response['Contents']] | ||
else: | ||
logger.info("No files found in bucket %s.", bucket_name) | ||
return [] | ||
except Exception as e: | ||
logger.error("Error listing files in bucket %s: %s", bucket_name, e) | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list_files 重複定義囉 (43 行)
hihi,