Fix config file parsing and improve backup/restore functionality
- Fix external_server.conf parsing to skip comment lines and empty lines - Update routes.py get_db_connection() to handle comments - Update settings.py get_external_db_connection() to handle comments - Improve restore_backup() to use mariadb command instead of Python parsing - Remove SQLite database creation (MariaDB only) - Add environment detection for dump command (mariadb-dump vs mysqldump) - Add conditional SSL flag based on Docker environment - Fix database restore to handle MariaDB sandbox mode comments
This commit is contained in:
@@ -680,14 +680,14 @@ def verify_database_setup():
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
# Check SQLite database
|
||||
instance_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../instance'))
|
||||
sqlite_path = os.path.join(instance_folder, 'users.db')
|
||||
|
||||
if os.path.exists(sqlite_path):
|
||||
print_success("SQLite database 'users.db' exists")
|
||||
else:
|
||||
print_error("SQLite database 'users.db' missing")
|
||||
# SQLite check disabled - using MariaDB only
|
||||
# instance_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../instance'))
|
||||
# sqlite_path = os.path.join(instance_folder, 'users.db')
|
||||
#
|
||||
# if os.path.exists(sqlite_path):
|
||||
# print_success("SQLite database 'users.db' exists")
|
||||
# else:
|
||||
# print_error("SQLite database 'users.db' missing")
|
||||
|
||||
return True
|
||||
|
||||
@@ -707,7 +707,7 @@ def main():
|
||||
create_warehouse_locations_table,
|
||||
create_permissions_tables,
|
||||
create_users_table_mariadb,
|
||||
create_sqlite_tables,
|
||||
# create_sqlite_tables, # Disabled - using MariaDB only
|
||||
create_database_triggers,
|
||||
populate_permissions_data,
|
||||
update_external_config,
|
||||
@@ -731,7 +731,7 @@ def main():
|
||||
print(f"📅 Completed at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print("\n📋 Setup Summary:")
|
||||
print(" • MariaDB tables created with triggers")
|
||||
print(" • SQLite user database initialized")
|
||||
print(" • MariaDB users table initialized")
|
||||
print(" • Permissions system fully configured")
|
||||
print(" • Default superadmin user created (username: superadmin, password: superadmin123)")
|
||||
print(" • Configuration files updated")
|
||||
|
||||
Reference in New Issue
Block a user