Loading app/main.py +7 −7 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ def configure_boto(env_ctx: str = None, region: str = None, role_arn: str = None # Assume Role with Web Identity Provider # see: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#assume-role-with-web-identity-provider logger.info("Auth method: STS Assume Role with Web Identity Provider") with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", delete=False) as token_file: with tempfile.NamedTemporaryFile( mode="w", encoding="utf-8", delete=False ) as token_file: token_file.write(jwt_token) token_file.close() os.environ["AWS_ROLE_ARN"] = role_arn Loading Loading @@ -85,7 +87,9 @@ def guess_env_ctx() -> str: def get_var(env_ctx: str, var_suffix: str) -> Optional[str]: return getenv_checked(f"AWS_{env_ctx}_{var_suffix}") or getenv_checked(f"AWS_{var_suffix}") return getenv_checked(f"AWS_{env_ctx}_{var_suffix}") or getenv_checked( f"AWS_{var_suffix}" ) # Workaround the GitLab bug with forced exposed variables: Loading @@ -105,12 +109,8 @@ def ping(): @app.exception_handler(Exception) async def uncaught_exception_handler(_: Request, exc: Exception) -> Response: return PlainTextResponse( content="Internal Server Error", content=f"Internal Server Error\nCause: [{exc.__class__.__qualname__}] {str(exc)}", status_code=HTTPStatus.INTERNAL_SERVER_ERROR, headers={ "x-error-type": exc.__class__.__qualname__, "x-error-message": str(exc), }, ) Loading Loading
app/main.py +7 −7 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ def configure_boto(env_ctx: str = None, region: str = None, role_arn: str = None # Assume Role with Web Identity Provider # see: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#assume-role-with-web-identity-provider logger.info("Auth method: STS Assume Role with Web Identity Provider") with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", delete=False) as token_file: with tempfile.NamedTemporaryFile( mode="w", encoding="utf-8", delete=False ) as token_file: token_file.write(jwt_token) token_file.close() os.environ["AWS_ROLE_ARN"] = role_arn Loading Loading @@ -85,7 +87,9 @@ def guess_env_ctx() -> str: def get_var(env_ctx: str, var_suffix: str) -> Optional[str]: return getenv_checked(f"AWS_{env_ctx}_{var_suffix}") or getenv_checked(f"AWS_{var_suffix}") return getenv_checked(f"AWS_{env_ctx}_{var_suffix}") or getenv_checked( f"AWS_{var_suffix}" ) # Workaround the GitLab bug with forced exposed variables: Loading @@ -105,12 +109,8 @@ def ping(): @app.exception_handler(Exception) async def uncaught_exception_handler(_: Request, exc: Exception) -> Response: return PlainTextResponse( content="Internal Server Error", content=f"Internal Server Error\nCause: [{exc.__class__.__qualname__}] {str(exc)}", status_code=HTTPStatus.INTERNAL_SERVER_ERROR, headers={ "x-error-type": exc.__class__.__qualname__, "x-error-message": str(exc), }, ) Loading