Bug fix for Event Device related fields. the ID needed to be searchable.
Quick removal of the password from the log output
This commit is contained in:
@@ -9,7 +9,7 @@ from sqlalchemy import create_engine
|
|||||||
from app.config import settings
|
from app.config import settings
|
||||||
|
|
||||||
log = logging.getLogger('root')
|
log = logging.getLogger('root')
|
||||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
|
|
||||||
# 1. Thread-local storage for capturing last SQL error message
|
# 1. Thread-local storage for capturing last SQL error message
|
||||||
_sql_error_state = threading.local()
|
_sql_error_state = threading.local()
|
||||||
@@ -57,17 +57,19 @@ def reconnect_db() -> bool:
|
|||||||
Useful after bootstrapping new credentials from the 'cfg' table.
|
Useful after bootstrapping new credentials from the 'cfg' table.
|
||||||
"""
|
"""
|
||||||
global engine, db, db_uri
|
global engine, db, db_uri
|
||||||
|
|
||||||
log.info("DB SQL Core: Refreshing database connection engine...")
|
log.info("DB SQL Core: Refreshing database connection engine...")
|
||||||
try:
|
try:
|
||||||
if engine:
|
if engine:
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
log.info("DB SQL Core: Disposed of previous database engine.")
|
log.info("DB SQL Core: Disposed of previous database engine.")
|
||||||
|
|
||||||
db_uri = settings.SQLALCHEMY_DB_URI
|
db_uri = settings.SQLALCHEMY_DB_URI
|
||||||
engine = create_ae_engine(db_uri)
|
engine = create_ae_engine(db_uri)
|
||||||
db = engine.connect()
|
db = engine.connect()
|
||||||
log.info(f"DB SQL Core: Database engine re-established successfully: {db_uri}")
|
|
||||||
|
safe_uri = db_uri.split('@')[-1] if '@' in db_uri else db_uri
|
||||||
|
log.info(f"DB SQL Core: Database engine re-established successfully: {safe_uri}")
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("DB SQL Core: FAILED to refresh database engine!")
|
log.exception("DB SQL Core: FAILED to refresh database engine!")
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ class Event_Device_Base(BaseModel):
|
|||||||
api_secret_key: Optional[str]
|
api_secret_key: Optional[str]
|
||||||
|
|
||||||
api_base_url: Optional[str]
|
api_base_url: Optional[str]
|
||||||
app_server_base_url: Optional[str]
|
app_base_url: Optional[str]
|
||||||
file_server_base_url: Optional[str]
|
file_server_base_url: Optional[str]
|
||||||
|
|
||||||
api_base_url_bak: Optional[str] # Backup URL
|
api_base_url_bak: Optional[str] # Backup URL
|
||||||
app_server_base_url_bak: Optional[str] # Backup URL
|
app_base_url_bak: Optional[str] # Backup URL
|
||||||
file_server_base_url_bak: Optional[str] # Backup URL
|
file_server_base_url_bak: Optional[str] # Backup URL
|
||||||
|
|
||||||
trigger_open_filename: Optional[str] # The file hash filename
|
trigger_open_filename: Optional[str] # The file hash filename
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ events_general_obj_li = {
|
|||||||
'base_name': Event_Device_Base,
|
'base_name': Event_Device_Base,
|
||||||
# V3 Search Security:
|
# V3 Search Security:
|
||||||
'searchable_fields': [
|
'searchable_fields': [
|
||||||
|
'id', 'event_device_id', 'account_id', 'event_id', 'event_location_id',
|
||||||
'event_device_id_random', 'account_id_random', 'event_id_random',
|
'event_device_id_random', 'account_id_random', 'event_id_random',
|
||||||
'event_location_id_random', 'code', 'name', 'description', 'app_mode',
|
'event_location_id_random', 'code', 'name', 'description', 'app_mode',
|
||||||
'enable', 'hide', 'priority', 'sort', 'group', 'event_notes', 'notes',
|
'enable', 'hide', 'priority', 'sort', 'group', 'event_notes', 'notes',
|
||||||
|
|||||||
Reference in New Issue
Block a user