-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
60 lines (52 loc) · 2.57 KB
/
run.py
File metadata and controls
60 lines (52 loc) · 2.57 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Policy-as-Code Platform - Application Entry Point
==================================================
This is the main entry point for running the Flask application.
Usage:
python run.py
The application will start on http://localhost:5000 by default.
"""
import os
from app import create_app
# Create the Flask application instance
# Use 'development' config by default, can be overridden via environment variable
config_name = os.environ.get('FLASK_CONFIG', 'development')
app = create_app(config_name)
if __name__ == '__main__':
# Get configuration from environment or use defaults
host = os.environ.get('FLASK_HOST', '0.0.0.0')
port = int(os.environ.get('FLASK_PORT', 5000))
debug = os.environ.get('FLASK_DEBUG', 'True').lower() == 'true'
print("""
╔═══════════════════════════════════════════════════════════════╗
║ ║
║ Policy-as-Code Platform ║
║ ======================== ║
║ ║
║ A Flask-based authorization system using ║
║ Open Policy Agent (OPA) for Policy-as-Code ║
║ ║
╚═══════════════════════════════════════════════════════════════╝
""")
print(f" 🚀 Starting server on http://{host}:{port}")
print(f" 📁 Configuration: {config_name}")
print(f" 🔧 Debug mode: {debug}")
print("")
print(" 📚 Quick Links:")
print(f" - Dashboard: http://localhost:{port}/dashboard")
print(f" - API Docs: http://localhost:{port}/api-docs")
print(f" - Login: http://localhost:{port}/login")
print("")
print(" 🔑 Test Credentials:")
print(" - Admin: admin / admin123")
print(" - Manager: manager / manager123")
print(" - Employee: employee / employee123")
print("")
print(" 💡 To start OPA server (optional):")
print(" opa run --server opa_policies/")
print("")
print(" Press Ctrl+C to stop the server")
print(" " + "=" * 60)
print("")
# Run the Flask development server
app.run(host=host, port=port, debug=debug)