Skip to content

Commit 198a6ef

Browse files
committed
fix(basic-auth): cache responses from ssm parameter store
1 parent f1d2e3c commit 198a6ef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

terraform/modules/s3pypi/basic_auth/handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import logging
55
from dataclasses import dataclass
6+
from functools import lru_cache
67

78
import boto3
89

@@ -43,6 +44,7 @@ class User:
4344
password_salt: str
4445

4546

47+
@lru_cache(maxsize=1024)
4648
def get_user(domain: str, username: str) -> User:
4749
data = boto3.client("ssm", region_name=region).get_parameter(
4850
Name=f"/s3pypi/{domain}/users/{username}",

terraform/modules/s3pypi/basic_auth/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ data "archive_file" "basic_auth" {
2626
resource "aws_lambda_function" "basic_auth" {
2727
function_name = "s3pypi-basic-auth-${replace(var.domain, ".", "-")}"
2828

29-
runtime = "python3.8"
29+
runtime = "python3.14"
3030
timeout = 5
3131
publish = true
3232

0 commit comments

Comments
 (0)