Skip to content

Commit cb9fc55

Browse files
committed
fixed systemd init
1 parent d55a6d8 commit cb9fc55

2 files changed

Lines changed: 13 additions & 24 deletions

File tree

app/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ def create_app(config_class=Config):
149149
app.logger.warning(f"Could not register security handlers (blinker may be missing): {e}")
150150
# Continue without security event handlers if blinker is not available
151151

152-
# Log successful initialization
153-
log_system_event('application_ready', 'CoreSecFrame application initialized successfully')
152+
# Log successful initialization (This will be moved to run.py to ensure app context)
153+
# log_system_event('application_ready', 'CoreSecFrame application initialized successfully')
154154

155155
return app
156156

run.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
app = create_app()
66

7+
if app: # Ensure app object was created successfully
8+
# Import log_system_event if it's not already imported at the top of run.py
9+
# Assuming it might not be, let's add a local import for safety.
10+
from app.core.logging import log_system_event
11+
with app.app_context():
12+
log_system_event('application_ready', 'CoreSecFrame application initialized successfully')
13+
714
def is_wsl_environment():
815
"""Detects if the app is running in a WSL environment"""
916
try:
@@ -13,26 +20,8 @@ def is_wsl_environment():
1320
except Exception:
1421
return False
1522

16-
def start_novnc_service():
17-
"""Starts the noVNC systemd service if it's not already running"""
18-
try:
19-
# Check if service is active
20-
status = subprocess.run(
21-
["systemctl", "is-active", "--quiet", "novnc.service"]
22-
)
23-
if status.returncode != 0:
24-
print("ℹ️ Starting noVNC service via systemd...")
25-
subprocess.run(["sudo", "systemctl", "start", "novnc.service"])
26-
else:
27-
print("✅ noVNC service already running")
28-
except Exception as e:
29-
print(f"❌ Failed to check/start noVNC service: {e}")
30-
3123
if __name__ == '__main__':
32-
if not is_wsl_environment():
33-
print("🖥️ Native Linux detected. Ensuring noVNC service is running...")
34-
start_novnc_service()
35-
else:
36-
print("💡 WSL environment detected. Skipping noVNC systemd service startup.")
37-
38-
socketio.run(app, debug=False, host='0.0.0.0')
24+
# The logic for starting noVNC service has been removed.
25+
# is_wsl_environment() function remains if needed elsewhere,
26+
# or can be removed if this was its only use.
27+
socketio.run(app, debug=False, host='0.0.0.0', allow_unsafe_werkzeug=True)

0 commit comments

Comments
 (0)