Borvik / vscode-postgres

PostgreSQL extension for vscode providing explorer, highlighting, diagnostics, and intellisense
MIT License
228 stars 49 forks source link

[feature request] automate `+` "add connection" or inject connection details via code/config #256

Open mratanusarkar opened 1 month ago

mratanusarkar commented 1 month ago

Issue

When using the ckolkman.vscode-postgres extension in GitHub Codespaces or dev containers, currently we have to manually add connection details (host, username, password, etc.) each time. This is time-consuming and repetitive, especially for projects with an "it-just-works" or "one-click-dev-setup" goal.

Request

Automate the PostgreSQL connection setup during the container build process in one of the following ways:

  1. via environment variables or configuration files (e.g., .devcontainer/devcontainer.json, .vscode/settings.json).
  2. or injecting connection details using code or .sh script instead of manually entering them through the VSCode GUI.

The goal is to automate this manual entry process.

I understand that saving the credentials in settings.json is not secure and is a bad practice. But using devcontainer.json or setup.sh script to take the credentials from an .env file or process.env and inject them to auto add a new postgres connection would follow the best practices and would be a great and very useful feature!

Relevant Discussions

There are already ongoing discussions and feature requests from the community for similar use cases. Here are some relevant threads:

Conclusion:

This feature would save time, simplify developer workflows and enhance the experience, especially in environments like Dev Containers or GitHub Codespaces, where setting up database connections manually is inefficient.

Addressing this request can close multiple existing open issues and handle many use cases mentioned in the same.