hm_ai_qc_report_tool/deploy/generate_password.py
nickviljoen f21e41afc3 v1.2.0: Add Docker deployment, simplify auth to local login, production config
- Add Dockerfile, docker-compose.yml, .dockerignore for containerised deployment
- Add deploy/ scripts (deploy.sh, nginx/apache configs, password generator)
- Replace MSAL/Azure AD auth with local username/password authentication
- Add login.html template
- Simplify app.py, middleware, and auth routes for production use
- Update gunicorn_config.py and wsgi.py for Docker/production
- Update templates to work with new auth and URL prefix handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:37:53 +02:00

32 lines
890 B
Python

#!/usr/bin/env python3
"""Generate AUTH_USERS env var value with werkzeug password hash.
Usage:
python deploy/generate_password.py
python deploy/generate_password.py admin mypassword
"""
import sys
from werkzeug.security import generate_password_hash
def main():
if len(sys.argv) == 3:
username = sys.argv[1]
password = sys.argv[2]
else:
username = input("Username: ").strip()
password = input("Password: ").strip()
if not username or not password:
print("Error: username and password are required", file=sys.stderr)
sys.exit(1)
hashed = generate_password_hash(password)
print(f"\nAdd this to your .env file:\n")
print(f"AUTH_USERS={username}:{hashed}")
print(f"\nFor multiple users, comma-separate:")
print(f"AUTH_USERS={username}:{hashed},user2:<hash2>")
if __name__ == "__main__":
main()