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:
@@ -2,8 +2,9 @@
|
||||
import os
|
||||
|
||||
def create_default_user(db, User, bcrypt):
|
||||
username = os.getenv('DEFAULT_USER', 'admin')
|
||||
password = os.getenv('DEFAULT_PASSWORD', '1234')
|
||||
# Use ADMIN_USER and ADMIN_PASSWORD to match docker-compose environment variables
|
||||
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')
|
||||
existing_user = User.query.filter_by(username=username).first()
|
||||
if not existing_user:
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
image: digiserver:latest
|
||||
container_name: digiserver
|
||||
ports:
|
||||
- "8880:5000"
|
||||
- "80:5000"
|
||||
environment:
|
||||
- FLASK_APP=app.py
|
||||
- FLASK_RUN_HOST=0.0.0.0
|
||||
|
||||
Reference in New Issue
Block a user