-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_dotenv.py
37 lines (25 loc) · 974 Bytes
/
create_dotenv.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
29
30
31
32
33
34
import hvac
from rich.console import Console
import os
import sys
def main():
console = Console(color_system="auto")
# with console.status("Working...", spinner="dots"):
if os.path.exists(".env"):
console.print("[red].env file already exists. Please delete it. Exiting...")
sys.exit()
mongo_user = console.input("[green]MongoDB Username: ")
mongo_pass = console.input("[green]MongoDB Password: ")
minio_user = console.input("[green]Minio Root Username: ")
minio_pass = console.input("[green]Minio Root Password: ")
with open(".env", "w") as f:
f.write(f"SECRET={os.urandom(24).hex()}")
f.write("\n")
f.write(f"MONGO_USERNAME={mongo_user}\n")
f.write(f"MONGO_PASSWORD={mongo_pass}\n")
f.write("\n")
f.write(f"MINIO_USERNAME={minio_user}\n")
f.write(f"MINIO_PASSWORD={minio_pass}\n")
f.write("\n")
if __name__ == "__main__":
main()