Commit 41291e50 authored by Ray Walker's avatar Ray Walker
Browse files

Merge branch 'fix/missing-env-var' into 'develop'

Fix missing environment variable and add correrponding check

See merge request !2
parents fe811e89 f77324f1
Pipeline #33276 passed with stages
in 4 minutes and 18 seconds
......@@ -25,13 +25,24 @@ APP_NAME = "bq-gcs"
APP_VERSION = "1.2.1"
RELEASE_STRING = "{}@{}".format(APP_NAME, APP_VERSION)
# Check for env variables
for env_variable in [
"BUCKET",
"ENTITY",
"ENVIRONMENT",
"PROJECT",
]:
if env_variable not in environ:
raise Exception(f"{env_variable} not found in environment")
BUCKET = environ["BUCKET"]
ENTITY = environ["ENTITY"]
ENVIRONMENT = environ["ENVIRONMENT"]
PROJECT = environ["PROJECT"]
LOGGER = logging.getLogger()
if "prod" in environ["ENVIRONMENT"]:
if "prod" in ENVIRONMENT:
LOGGER.setLevel(logging.INFO)
else:
LOGGER.setLevel(logging.DEBUG)
......
......@@ -29,6 +29,7 @@ resource "google_cloudfunctions_function" "bq_gcs_extract" {
BUCKET = google_storage_bucket.destination.name
ENTITY = var.entity
ENVIRONMENT = var.environment
PROJECT = var.function_project
OUTPUT_TOPIC = var.output_topic
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment