Fix admin authentication and update port mapping

- Fix environment variable mismatch in create_default_user.py
- Now correctly uses ADMIN_USER and ADMIN_PASSWORD from docker-compose
- Maintains backward compatibility with DEFAULT_USER and DEFAULT_PASSWORD
- Change port mapping from 8880 to 80 for easier access
- Resolves login issues with admin user credentials
This commit is contained in:
DigiServer Developer
2025-08-11 17:01:58 +03:00
parent 091e985ff2
commit 5e4950563c
2 changed files with 4 additions and 3 deletions

View File

@@ -2,8 +2,9 @@
import os import os
def create_default_user(db, User, bcrypt): def create_default_user(db, User, bcrypt):
username = os.getenv('DEFAULT_USER', 'admin') # Use ADMIN_USER and ADMIN_PASSWORD to match docker-compose environment variables
password = os.getenv('DEFAULT_PASSWORD', '1234') username = os.getenv('ADMIN_USER', os.getenv('DEFAULT_USER', 'admin'))
password = os.getenv('ADMIN_PASSWORD', os.getenv('DEFAULT_PASSWORD', '1234'))
hashed_password = bcrypt.generate_password_hash(password).decode('utf-8') hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')
existing_user = User.query.filter_by(username=username).first() existing_user = User.query.filter_by(username=username).first()
if not existing_user: if not existing_user:

View File

@@ -8,7 +8,7 @@ services:
image: digiserver:latest image: digiserver:latest
container_name: digiserver container_name: digiserver
ports: ports:
- "8880:5000" - "80:5000"
environment: environment:
- FLASK_APP=app.py - FLASK_APP=app.py
- FLASK_RUN_HOST=0.0.0.0 - FLASK_RUN_HOST=0.0.0.0