diff --git a/.env.example b/.env.example index 09c24fcf..228fde76 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ -DB_CONNECTION=sqlite +XUI_DB_CONNECTION=sqlite # If DB connection is "mysql" -# DB_HOST=127.0.0.1 -# DB_PORT=3306 -# DB_DATABASE=xui -# DB_USERNAME=root -# DB_PASSWORD= \ No newline at end of file +# XUI_DB_HOST=127.0.0.1 +# XUI_DB_PORT=3306 +# XUI_DB_DATABASE=xui +# XUI_DB_USERNAME=root +# XUI_DB_PASSWORD= \ No newline at end of file diff --git a/config/config.go b/config/config.go index 9279fc0d..942de7fb 100644 --- a/config/config.go +++ b/config/config.go @@ -76,12 +76,12 @@ type DatabaseConfig struct { // GetDatabaseConfig returns the database configuration from environment variables func GetDatabaseConfig() (*DatabaseConfig, error) { config := &DatabaseConfig{ - Connection: strings.ToLower(os.Getenv("DB_CONNECTION")), - Host: os.Getenv("DB_HOST"), - Port: os.Getenv("DB_PORT"), - Database: os.Getenv("DB_DATABASE"), - Username: os.Getenv("DB_USERNAME"), - Password: os.Getenv("DB_PASSWORD"), + Connection: strings.ToLower(os.Getenv("XUI_DB_CONNECTION")), + Host: os.Getenv("XUI_DB_HOST"), + Port: os.Getenv("XUI_DB_PORT"), + Database: os.Getenv("XUI_DB_DATABASE"), + Username: os.Getenv("XUI_DB_USERNAME"), + Password: os.Getenv("XUI_DB_PASSWORD"), } if config.Connection == "mysql" {