Add KHOJ_prefix to server admin credentials environment variables

This commit is contained in:
Debanjum Singh Solanky 2023-11-14 16:09:56 -08:00
parent ee005de662
commit 795ec9eb55
2 changed files with 6 additions and 4 deletions

View file

@ -43,8 +43,8 @@ services:
- POSTGRES_PORT=5432 - POSTGRES_PORT=5432
- KHOJ_DJANGO_SECRET_KEY=secret - KHOJ_DJANGO_SECRET_KEY=secret
- KHOJ_DEBUG=True - KHOJ_DEBUG=True
- ADMIN_EMAIL=username@example.com - KHOJ_ADMIN_EMAIL=username@example.com
- ADMIN_PASSWORD=password - KHOJ_ADMIN_PASSWORD=password
command: --host="0.0.0.0" --port=42110 -vv --anonymous-mode command: --host="0.0.0.0" --port=42110 -vv --anonymous-mode

View file

@ -21,8 +21,8 @@ def initialization():
logger.info( logger.info(
"👩‍✈️ Setting up admin user. These credentials will allow you to configure your server at /server/admin." "👩‍✈️ Setting up admin user. These credentials will allow you to configure your server at /server/admin."
) )
email_addr = os.getenv("ADMIN_EMAIL") or input("Email: ") email_addr = os.getenv("KHOJ_ADMIN_EMAIL") or input("Email: ")
password = os.getenv("ADMIN_PASSWORD") or input("Password: ") password = os.getenv("KHOJ_ADMIN_PASSWORD") or input("Password: ")
admin_user = KhojUser.objects.create_superuser(email=email_addr, username=email_addr, password=password) admin_user = KhojUser.objects.create_superuser(email=email_addr, username=email_addr, password=password)
logger.info(f"👩‍✈️ Created admin user: {admin_user.email}") logger.info(f"👩‍✈️ Created admin user: {admin_user.email}")
@ -37,6 +37,8 @@ def initialization():
return return
try: try:
# Note: gpt4all package is not available on all devices.
# So ensure gpt4all package is installed before continuing this step.
import gpt4all import gpt4all
use_offline_model = input("Use offline chat model? (y/n): ") use_offline_model = input("Use offline chat model? (y/n): ")