Skip to content

Commit

Permalink
Add IMAGE_TAG environment variable (#556)
Browse files Browse the repository at this point in the history
When working on another project we realized it would be useful for the
application to have access to the current version of the application.
  • Loading branch information
lorenyu authored Feb 20, 2024
1 parent bea4396 commit caca514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def hello_world():
def health():
conn = get_db_connection()
conn.execute("SELECT 1")
return "OK"
return {
"status": "healthy",
"version": os.environ.get("IMAGE_TAG"),
}


@app.route("/migrations")
Expand Down
1 change: 1 addition & 0 deletions infra/modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ locals {
{ name : "PORT", value : tostring(var.container_port) },
{ name : "AWS_DEFAULT_REGION", value : data.aws_region.current.name },
{ name : "AWS_REGION", value : data.aws_region.current.name },
{ name : "IMAGE_TAG", value : var.image_tag },
]
db_environment_variables = var.db_vars == null ? [] : [
{ name : "DB_HOST", value : var.db_vars.connection_info.host },
Expand Down

0 comments on commit caca514

Please sign in to comment.