1
0
favro-sync/favro_sync/secrets.py
Jon Michael Aanes a1f4a8207e
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 24s
Load collection filter from file
2025-01-08 15:12:57 +01:00

30 lines
665 B
Python

import secret_loader
secrets = secret_loader.SecretLoader()
def has_secrets():
return secrets.load('FAVRO_ORGANIZATION_ID') is not None
def favro_org_id():
return secrets.load_or_fail('FAVRO_ORGANIZATION_ID')
def favro_username():
return secrets.load_or_fail('FAVRO_USERNAME')
def favro_password():
return secrets.load_or_fail('FAVRO_PASSWORD')
def favro_collection_filter() -> frozenset[str]:
loaded = secrets.load('FAVRO_COLLECTION_FILTER')
if loaded is None:
return None
values = loaded.strip().split('\n')
values = [v.strip() for v in values]
values = [v for v in values if v]
return frozenset(values)