Commit graph

5 commits

Author SHA1 Message Date
Ali Golzar
3850e2f070
feat: Add MySQL database support (#3024)
* feat: Add MySQL database support

- Add MySQL database support with environment-based configuration
- Fix MySQL compatibility issue with 'key' column name
- Maintain SQLite as default database
- Add proper validation for MySQL configuration
- Test and verify compatibility with existing database
- Replaced raw SQL queries using JSON_EACH functions with standard GORM queries
- Modified functions to handle JSON parsing in Go code instead of database since JSON_EACH is not available on MySQL or MariaDB:
  - getAllEmails()
  - GetClientTrafficByID()
  - getFallbackMaster()
  - MigrationRemoveOrphanedTraffics()

The system now supports both MySQL and SQLite databases, with SQLite remaining as the default option. MySQL connection is only used when explicitly configured through environment variables.

* refactor: prefix env variables of database with XUI_ to support direct environment usage without .env file

All database configuration environment variables now start with the XUI_ prefix to avoid conflicts and allow configuration via system-level environment variables, not just the .env file.
2025-05-21 12:04:38 +02:00
Hamidreza
1028319386
🚀 Some improvements for x-ui.sh and ip job (#665) 2023-07-01 15:56:43 +03:30
Ho3ein
5188d516e3
new - loglevel (#612) 2023-06-16 18:25:33 +03:30
Hamidreza Ghavami
4548755375 update db config path 2023-04-14 00:03:46 +04:30
MHSanaei
b73e4173a3 3x-ui 2023-02-09 22:48:06 +03:30