20 lines
565 B
Python
20 lines
565 B
Python
|
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)
|