mirror of
https://github.com/offen/website.git
synced 2024-11-22 17:10:29 +01:00
fix use before definition
This commit is contained in:
parent
fe57135d24
commit
c02576c794
@ -11,6 +11,16 @@ boto_client = session.client(
|
|||||||
service_name="secretsmanager", region_name=environ.get("AWS_REGION")
|
service_name="secretsmanager", region_name=environ.get("AWS_REGION")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_secret(boto_client, secret_name):
|
||||||
|
ssm_response = boto_client.get_secret_value(
|
||||||
|
SecretId="{}/accounts/{}".format(environ.get("STAGE"), secret_name)
|
||||||
|
)
|
||||||
|
if "SecretString" in ssm_response:
|
||||||
|
return ssm_response["SecretString"]
|
||||||
|
return base64.b64decode(ssm_response["SecretBinary"])
|
||||||
|
|
||||||
|
|
||||||
basic_auth_user = get_secret(boto_client, "basicAuthUser")
|
basic_auth_user = get_secret(boto_client, "basicAuthUser")
|
||||||
hashed_basic_auth_password = get_secret(boto_client, "hashedBasicAuthPassword")
|
hashed_basic_auth_password = get_secret(boto_client, "hashedBasicAuthPassword")
|
||||||
|
|
||||||
@ -49,15 +59,6 @@ def build_response(api_arn, allow):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_secret(secret_name):
|
|
||||||
ssm_response = boto_client.get_secret_value(
|
|
||||||
SecretId="{}/accounts/{}".format(environ.get("STAGE"), secret_name)
|
|
||||||
)
|
|
||||||
if "SecretString" in ssm_response:
|
|
||||||
return ssm_response["SecretString"]
|
|
||||||
return base64.b64decode(ssm_response["SecretBinary"])
|
|
||||||
|
|
||||||
|
|
||||||
def handler(event, context):
|
def handler(event, context):
|
||||||
api_arn = build_api_arn(event["methodArn"])
|
api_arn = build_api_arn(event["methodArn"])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user