Skip to content

Commit 65423f4

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

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

terraform/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 4.0"
5+
version = "~> 6.0"
66
}
77
}
88
}

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 4.0"
5+
version = "~> 6.0"
66
}
77
}
88
}
@@ -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

terraform/modules/s3pypi/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 4.0"
5+
version = "~> 6.0"
66
configuration_aliases = [
77
aws.us_east_1,
88
]

0 commit comments

Comments
 (0)