mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
/data and /tmp standarization
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
def run_sqlite_command(command):
|
||||
full_command = f"sudo docker exec -i netalertx sqlite3 /app/db/app.db \"{command}\""
|
||||
# Use environment variable with fallback
|
||||
db_path = os.path.join(
|
||||
os.getenv('NETALERTX_DB', '/data/db'),
|
||||
'app.db'
|
||||
)
|
||||
full_command = f"sudo docker exec -i netalertx sqlite3 {db_path} \"{command}\""
|
||||
try:
|
||||
result = subprocess.run(full_command, shell=True, text=True, capture_output=True)
|
||||
if result.stderr:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# This script recreates the database from schema code.
|
||||
#Database location
|
||||
NETALERTX_DB_FILE=/app/db/app.db
|
||||
# Database location
|
||||
NETALERTX_DB_FILE=${NETALERTX_DB:-/data/db}/app.db
|
||||
|
||||
#remove the old database
|
||||
rm ${NETALERTX_DB_FILE}
|
||||
|
||||
Reference in New Issue
Block a user