Skip to content

[server][gui] Default database connection for new products (#2985) - #5206

Open
adnansamore wants to merge 1 commit into
Ericsson:masterfrom
adnansamore:feature/2985-product-defaults
Open

adnansamore wants to merge 1 commit into
Ericsson:masterfrom
adnansamore:feature/2985-product-defaults

Conversation

@adnansamore

Copy link
Copy Markdown

What this does

As suggested in the issue comments, the default database connection for new products can now be set in server_config.json. When a super user opens the "New product" dialog, those values are already filled in.

Example config:

"product_defaults": {
  "connection": {
    "engine": "postgresql",
    "host": "db.test.org",
    "port": 5432,
    "username": "codechecker"
  }
}

Changes

  • API: new getDefaultProductConnection() in products.thrift (super user only). API version bumped to 6.75.
  • Server: session_manager.py reads the product_defaults.connection section on startup and again on --reload. Invalid values (unknown engine, a port that isn't a number, empty strings) are skipped with a warning, so the server still starts.
  • GUI: NewProductBtn.vue asks for the defaults when the dialog opens. It only fills empty fields, so it never overwrites anything the user already typed. If the request fails, the form works the same as before.
  • Config/docs: added the section with null values to server_config.json, so nothing changes by default. Documented it in docs/web/server_config.md.

Testing

  • New unit tests in web/server/tests/unit/test_product_defaults.py: parsing, invalid values, password is never returned, $ENV: values, reload.
  • New functional test in test_products.py: a super user gets the defaults and a normal user gets RequestFailed.
  • Ran it locally with a PostgreSQL default in the config: opening "New product" showed engine, host, port and username already filled in, and password and database name empty.
  • I couldn't run the functional test locally, so I'm relying on CI for that one.

@adnansamore
adnansamore force-pushed the feature/2985-product-defaults branch from 5805cef to f12c32f Compare November 26, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants