Skip to content

Commit 5bf2c87

Browse files
Update job_export.py
1 parent 337d18a commit 5bf2c87

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

job_export.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@
5050
filters = json.dumps({"filter": input_data.get("filter", {})})
5151
case_ids = gql.execute(filters=filters)
5252

53-
try:
54-
with open("/peregrine-creds.json") as pelican_creds_file:
55-
peregrine_creds = json.load(pelican_creds_file)
56-
except (FileNotFoundError, json.JSONDecodeError) as e:
57-
print(f"Failed to load credentials file: {e}")
58-
peregrine_creds = {}
53+
if os.path.exists("/peregrine-creds.json")
54+
try:
55+
with open("/peregrine-creds.json") as pelican_creds_file:
56+
peregrine_creds = json.load(pelican_creds_file)
57+
except json.JSONDecodeError as e:
58+
print(f"Failed to load credentials file: {e}")
59+
peregrine_creds = {}
60+
else:
61+
print(f"Credentials file not found: {e}")
5962

6063
# Set variables, prioritizing environment variables
6164
DB_HOST = os.getenv("DB_HOST", peregrine_creds.get("db_host"))

0 commit comments

Comments
 (0)