helloasso-paheko-adapter/helloasso_paheko_adapter/env.py

20 lines
565 B
Python
Raw Normal View History

2023-11-06 10:14:16 +00:00
import os
class Env:
HELLOASSO_API_CLIENT_ID: str
HELLOASSO_API_CLIENT_SECRET: str
PAHEKO_API_CLIENT_ID: str
PAHEKO_API_CLIENT_SECRET: str
def __init__(self):
self.load_from_process_env()
def load_from_process_env(self):
attr_keys = list(self.__class__.__dict__.keys()) + list(self.__annotations__.keys())
for k in attr_keys:
if k.startswith('__'): continue
from_env = None
if k in os.environ:
from_env = os.environ[k]
setattr(self, k, from_env)