forked from Roilek/logistique-agepoly-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.py
28 lines (23 loc) · 996 Bytes
/
env.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import ast
import os
from dotenv import load_dotenv
def get_env_variables() -> dict[str, str]:
"""Get environment variables from .env file."""
load_dotenv()
return {
'ENV': os.getenv('ENV'),
'HEROKU_PATH': os.getenv('HEROKU_PATH'),
'TOKEN': os.environ.get('TOKEN'),
'TRUFFE_TOKEN': os.environ.get('TRUFFE_TOKEN'),
'CALENDAR_ID': os.environ.get('CALENDAR_ID'),
'GSERVICE_CREDENTIALS': ast.literal_eval(os.environ.get('GSERVICE_CREDENTIALS')),
'MONGO_URI': os.environ.get('MONGO_URI'),
'SUPPORT_GROUP_ID': int(os.environ.get('SUPPORT_GROUP_ID')),
'MAINTAINERS_GROUP_ID': int(os.environ.get('MAINTAINERS_GROUP_ID'))
}
def store_env_variable(variable: str, value: any) -> None:
"""Store an environment variable in .env file."""
os.environ[variable] = str(value)
print(f"Stored {variable} in env. Value : {value}.")
# with open('.env', 'a') as f:
# f.write(f'{variable}="{value}"\n')