[GH-ISSUE #5153] [Feature]: saving configuration to db is not good idea #3620

Closed
opened 2026-10-31 20:33:46 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @liutianfang on GitHub (Jun 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5153

I use a nginx https server reverse proxy panel. when I tested and it worked OK , I add listening ip :127.0.0.1 in panel for security and restart panel, The panel can not visit!!!

I have to install sqlite3, search db structure, update value by sql command.

traditionally, json configuration file is easy to edit, vi can do it

Describe the solution you'd like

keep use json configuration file

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @liutianfang on GitHub (Jun 10, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5153 ### Is your feature request related to a problem? I use a nginx https server reverse proxy panel. when I tested and it worked OK , I add listening ip :127.0.0.1 in panel for security and restart panel, The panel can not visit!!! I have to install sqlite3, search db structure, update value by sql command. traditionally, json configuration file is easy to edit, vi can do it ### Describe the solution you'd like keep use json configuration file ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:33:46 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 10, 2026):

Thanks for the report. Two things here: a recovery tip for your current situation, and a note on the feature request.


Recovering from a 127.0.0.1 listen lockout

You don't need SQLite for this — the x-ui CLI can reset it from an SSH session on the server:

x-ui setting -listenIP 0.0.0.0
systemctl restart x-ui

Setting 0.0.0.0 clears the restriction and restores listening on all interfaces.
(Source: main.go updateSetting() + x-ui.sh SSH/security menu, option 2 — "Clear listen IP".)

Alternatively, run x-ui as root, navigate to the Security section, and choose the option to clear the listen IP — it runs the same command internally.


On the feature request: JSON config file

The panel intentionally stores all settings in the SQLite database (key webListen in the settings table) rather than a flat file. The reasons this is unlikely to change:

  • All settings, inbounds, clients, and traffic stats are co-located in one DB — splitting them into two storage mechanisms would significantly complicate the code.
  • The x-ui setting CLI already provides the "plain-text escape hatch" for situations exactly like yours: you can read and set any setting from an SSH shell without a database client.
  • A JSON file introduces its own failure modes (concurrent writes, missing vs. empty value ambiguity, merge conflicts on upgrade).

The documented recovery path (x-ui setting -listenIP 0.0.0.0) is the intended solution for this exact scenario. If you'd like to see it documented more prominently (e.g. a warning in the UI before applying a restrictive listen IP), that would be a more targeted improvement worth discussing.

<!-- gh-comment-id:4666734717 --> @github-actions[bot] commented on GitHub (Jun 10, 2026): Thanks for the report. Two things here: a recovery tip for your current situation, and a note on the feature request. --- ### Recovering from a 127.0.0.1 listen lockout You don't need SQLite for this — the `x-ui` CLI can reset it from an SSH session on the server: ```bash x-ui setting -listenIP 0.0.0.0 systemctl restart x-ui ``` Setting `0.0.0.0` clears the restriction and restores listening on all interfaces. (Source: `main.go` `updateSetting()` + `x-ui.sh` SSH/security menu, option 2 — "Clear listen IP".) Alternatively, run `x-ui` as root, navigate to the **Security** section, and choose the option to clear the listen IP — it runs the same command internally. --- ### On the feature request: JSON config file The panel intentionally stores all settings in the SQLite database (key `webListen` in the `settings` table) rather than a flat file. The reasons this is unlikely to change: - All settings, inbounds, clients, and traffic stats are co-located in one DB — splitting them into two storage mechanisms would significantly complicate the code. - The `x-ui setting` CLI already provides the "plain-text escape hatch" for situations exactly like yours: you can read and set any setting from an SSH shell without a database client. - A JSON file introduces its own failure modes (concurrent writes, missing vs. empty value ambiguity, merge conflicts on upgrade). The documented recovery path (`x-ui setting -listenIP 0.0.0.0`) is the intended solution for this exact scenario. If you'd like to see it documented more prominently (e.g. a warning in the UI before applying a restrictive listen IP), that would be a more targeted improvement worth discussing.
Author
Owner

@MHSanaei commented on GitHub (Jun 12, 2026):

Storing panel settings in the DB is an intentional design choice (it''s what lets the panel manage itself at runtime, sync nodes, and migrate between SQLite/PostgreSQL), so we won''t be moving back to flat config files. The lockout you hit has a supported recovery path that doesn''t require editing the DB by hand:

x-ui setting -listenIP ""

(or x-ui setting -show to inspect, and x-ui setting -port <n> etc.). That resets the listen binding so the panel is reachable again after a bad value. Closing as working-as-designed.

<!-- gh-comment-id:4688399879 --> @MHSanaei commented on GitHub (Jun 12, 2026): Storing panel settings in the DB is an intentional design choice (it''s what lets the panel manage itself at runtime, sync nodes, and migrate between SQLite/PostgreSQL), so we won''t be moving back to flat config files. The lockout you hit has a supported recovery path that doesn''t require editing the DB by hand: x-ui setting -listenIP "" (or `x-ui setting -show` to inspect, and `x-ui setting -port <n>` etc.). That resets the listen binding so the panel is reachable again after a bad value. Closing as working-as-designed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3620
No description provided.