Skip to content

Add database configuration store#1691

Merged
charisk merged 4 commits intomainfrom
shati-patel/add-db-config
Nov 2, 2022
Merged

Add database configuration store#1691
charisk merged 4 commits intomainfrom
shati-patel/add-db-config

Conversation

@shati-patel
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel commented Nov 1, 2022

Adds a database configuration file, which will contain state for the new (hidden) database panel introduced in #1682, e.g. what repo lists you've added, what repos you want to run against...

We've added a new DatabaseConfigStore class, which reads/modifies the config file (dbconfig.json). Nothing else should be able to modify the config, so we return a clone whenever anything calls getConfig().*
*note: we tried using Object.freeze() but that didn't give us the appropriate "deep" clone.

In a future PR we'll set up a "watcher" that checks for changes to the config.

See internal linked issue for more details! 🔗

Checklist

N/A - internal only 🍜

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This "config store" creates a `dbconfig.json` file (if it doesn't yet exist),
and reads the file to load the database panel state.

Only the database config store should be able to modify the config
— the config cannot be modified externally.

Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
@shati-patel shati-patel requested a review from a team November 1, 2022 15:42
@shati-patel shati-patel marked this pull request as ready for review November 1, 2022 15:45
@shati-patel shati-patel requested a review from a team as a code owner November 1, 2022 15:45
Comment thread extensions/ql-vscode/src/databases/database-config.ts
Comment thread extensions/ql-vscode/src/databases/db-config.ts Outdated
Comment thread extensions/ql-vscode/src/databases/db-config-store.ts Outdated
Comment thread extensions/ql-vscode/src/databases/db-config-store.ts Outdated
Copy link
Copy Markdown
Contributor

@norascheuch norascheuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question otherwise lgtm!

Comment thread extensions/ql-vscode/src/databases/db-config-store.ts
@charisk charisk merged commit 7296c64 into main Nov 2, 2022
@charisk charisk deleted the shati-patel/add-db-config branch November 2, 2022 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants