-
Notifications
You must be signed in to change notification settings - Fork 0
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
Isolated lambdas, moved auth to secrets manager #137
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified FilesNo covered modified files...
|
7b7f696
to
2d1602c
Compare
@@ -1,10 +1,11 @@ | |||
default_install_hook_types: [pre-commit, pre-push] | |||
repos: | |||
- repo: https://github.com/astral-sh/ruff-pre-commit | |||
rev: v0.2.1 | |||
rev: v0.5.7 |
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.
Noting for posterity that ruff is now up to v0.7.1 - but here i'm just syncing this to this repo's version
@@ -26,26 +26,10 @@ def _put_s3_data(name: str, bucket_name: str, client, data: dict, path: str = "a | |||
client.upload_fileobj(Bucket=bucket_name, Key=f"{path}/{name}", Fileobj=b_data) | |||
|
|||
|
|||
def create_auth(client, bucket_name: str, user: str, auth: str, site: str) -> str: | |||
def create_auth(client, user: str, auth: str, site: str) -> str: |
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.
this is now just a convenience script for getting the password hash
def get_secret(): | ||
"""Retrieves a specified secret. | ||
|
||
This is largely unmodified boilerplate from the secrets manager recommended approach | ||
for fetching secrets, except for getting the values from environment variables""" | ||
|
||
secret_name = os.environ.get("SECRET_NAME") | ||
region_name = os.environ.get("REGION") | ||
|
||
session = boto3.session.Session() | ||
client = session.client(service_name="secretsmanager", region_name=region_name) | ||
|
||
try: | ||
get_secret_value_response = client.get_secret_value(SecretId=secret_name) | ||
except ClientError as e: | ||
raise e | ||
|
||
return json.loads(get_secret_value_response["SecretString"]) | ||
|
||
|
||
def lambda_handler(event, context): | ||
del context | ||
# ---- aggregator specific logic | ||
user_db = get_s3_json_as_dict( | ||
os.environ.get("BUCKET_NAME"), f"{BucketPath.ADMIN.value}/auth.json" | ||
) | ||
user_db = get_secret() |
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.
this is section that is functionality change related to secrets.
There's a lot of files in this PR, but a good 90% of it is just renaming and adding symbolic links.