Skip to content

Commit

Permalink
Fix bot crashing when some optional env vars aren't filled up
Browse files Browse the repository at this point in the history
  • Loading branch information
l3v11 authored Oct 13, 2022
1 parent 951e3e3 commit 28318d3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
else:
AUTHORIZED_USERS = set()

DATABASE_URL = os.environ.get('DATABASE_URL', None)
DATABASE_URL = os.environ.get('DATABASE_URL', '')
if len(DATABASE_URL) == 0:
DATABASE_URL = None

IS_TEAM_DRIVE = os.environ.get('IS_TEAM_DRIVE', '')
IS_TEAM_DRIVE = IS_TEAM_DRIVE.lower() == 'true'
Expand Down Expand Up @@ -147,10 +149,15 @@
except Exception as err:
LOGGER.error(f"DRIVE_LIST_URL: {err}")

APPDRIVE_EMAIL = os.environ.get('APPDRIVE_EMAIL', None)
APPDRIVE_PASS = os.environ.get('APPDRIVE_PASS', None)
APPDRIVE_EMAIL = os.environ.get('APPDRIVE_EMAIL', '')
APPDRIVE_PASS = os.environ.get('APPDRIVE_PASS', '')
if len(APPDRIVE_EMAIL) == 0 or len(APPDRIVE_PASS) == 0:
APPDRIVE_EMAIL = None
APPDRIVE_PASS = None

GDTOT_CRYPT = os.environ.get('GDTOT_CRYPT', None)
GDTOT_CRYPT = os.environ.get('GDTOT_CRYPT', '')
if len(GDTOT_CRYPT) == 0:
GDTOT_CRYPT = None

if os.path.exists('drive_list'):
with open('drive_list', 'r+') as f:
Expand Down

0 comments on commit 28318d3

Please sign in to comment.