Add check if Airtable vars are defined
This commit is contained in:
parent
07b99b8192
commit
efeddd6c70
|
@ -15,16 +15,15 @@ import json
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
|
|
||||||
# Check and load Airtable environment variables
|
AIRTABLE_API_KEY = os.getenv("AIRTABLE_API_KEY")
|
||||||
airtable_env_vars = ["AIRTABLE_API_KEY", "AIRTABLE_BASE", "AIRTABLE_TABLE", "AIRTABLE_FIELD"]
|
AIRTABLE_BASE = os.getenv("AIRTABLE_BASE")
|
||||||
|
AIRTABLE_TABLE = os.getenv("AIRTABLE_TABLE")
|
||||||
|
AIRTABLE_FIELD = os.getenv("AIRTABLE_FIELD")
|
||||||
|
|
||||||
for e in airtable_env_vars:
|
# Check environment variables are defined
|
||||||
# Check environment variable is defined
|
for e in [AIRTABLE_API_KEY, AIRTABLE_BASE, AIRTABLE_TABLE, AIRTABLE_FIELD]
|
||||||
gete = os.getenv(e)
|
if not e:
|
||||||
if not gete:
|
sys.exit("Configuration error: Missing AirTable environment variable.")
|
||||||
sys.exit("Configuration error: Environment variable " + e + " is not defined")
|
|
||||||
# Set variable
|
|
||||||
exec(e + " = \"" + gete + "\"")
|
|
||||||
|
|
||||||
|
|
||||||
async def run_checks():
|
async def run_checks():
|
||||||
|
|
Reference in New Issue