Handle empty string defaults in kubernetes secrets.

This commit is contained in:
Philip Wafula 2021-06-23 07:02:22 +00:00
parent 28de7a4eac
commit 07583f0c3b
2 changed files with 10 additions and 2 deletions

View File

@ -87,10 +87,18 @@ for key in config.store.keys():
module = importlib.import_module(config.store[key])
if key == 'TASKS_AFRICASTALKING':
africastalking_notifier = module.AfricasTalkingNotifier
api_sender_id = config.get('AFRICASTALKING_API_SENDER_ID')
logg.debug(f'SENDER ID VALUE IS: {api_sender_id}')
if not api_sender_id:
api_sender_id = None
logg.debug(f'SENDER ID RESOLVED TO NONE: {api_sender_id}')
africastalking_notifier.initialize(
config.get('AFRICASTALKING_API_USERNAME'),
config.get('AFRICASTALKING_API_KEY'),
config.get('AFRICASTALKING_API_SENDER_ID')
api_sender_id
)

View File

@ -38,7 +38,7 @@ def get_user_by_phone_number(phone_number: str) -> Optional[Account]:
:rtype: Account|None
"""
# consider adding region to user's metadata
phone_number = process_phone_number(phone_number=phone_number, region='KE')
phone_number = process_phone_number(phone_number=phone_number, region=E164Format.region)
user = Account.session.query(Account).filter_by(phone_number=phone_number).first()
return user