Skip to content

Commit

Permalink
Update to use secrets manager
Browse files Browse the repository at this point in the history
  • Loading branch information
jdgsmallwood committed Jul 11, 2024
1 parent 657f76a commit 3061a04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lambda_function.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import traceback
import xml.etree.ElementTree as ET
Expand Down Expand Up @@ -75,7 +76,11 @@ def get_previous_uv(uv: float) -> float:


def send_message_to_telegram(message: str) -> None:
BOT_TOKEN = os.getenv("BOT_TOKEN")
client = boto3.client(
service_name="secretsmanager",
)
secret_value = client.get_secret_value(SecretId="telegram/uv")
BOT_TOKEN = json.loads(secret_value["SecretString"])["UV_TELEGRAM_TOKEN"]
CHAT_ID = os.getenv("CHAT_ID")
bot = telebot.TeleBot(BOT_TOKEN)
bot.send_message(CHAT_ID, message)

0 comments on commit 3061a04

Please sign in to comment.