mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-13 09:28:12 -05:00
feat(tool/Postgresql): Set default host and port for Postgresql source (#1927)
### Description This pull request addresses issue #41 by implementing default connection values for the Postgresql data source. When a user does not specify a host or port, the connection will now automatically default to `localhost:5432`. --- ### Detailed Changes - **docs/en/reference/prebuilt-tools.md** -updated the env variables host and port to optional in the doc - **internal/prebuiltconfigs/tools/postgres.yaml** - Added the default values to host and port. Specifically, they are now `host: ${POSTGRES_HOST:localhost}` and `port: ${POSTGRES_PORT:5432}`. This allows the configuration loader to directly use `"localhost"` or `"5432"` as a fallback if the `POSTGRES_HOST` or `POSTGRES_PORT` environment variables are not set. --- ### PR Checklist Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed CONTRIBUTING.md - [ ] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add ! if this involve a breaking change 🛠️ **Fixes** #41 --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
This commit is contained in:
committed by
GitHub
parent
b2ea4b7b8f
commit
7e6e88a21f
@@ -489,8 +489,8 @@ details on how to connect your AI tools (IDEs) to databases via Toolbox and MCP.
|
||||
|
||||
* `--prebuilt` value: `postgres`
|
||||
* **Environment Variables:**
|
||||
* `POSTGRES_HOST`: The hostname or IP address of the PostgreSQL server.
|
||||
* `POSTGRES_PORT`: The port number for the PostgreSQL server.
|
||||
* `POSTGRES_HOST`: (Optional) The hostname or IP address of the PostgreSQL server.
|
||||
* `POSTGRES_PORT`: (Optional) The port number for the PostgreSQL server.
|
||||
* `POSTGRES_DATABASE`: The name of the database to connect to.
|
||||
* `POSTGRES_USER`: The database username.
|
||||
* `POSTGRES_PASSWORD`: The password for the database user.
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
sources:
|
||||
postgresql-source:
|
||||
kind: postgres
|
||||
host: ${POSTGRES_HOST}
|
||||
port: ${POSTGRES_PORT}
|
||||
host: ${POSTGRES_HOST:localhost}
|
||||
port: ${POSTGRES_PORT:5432}
|
||||
database: ${POSTGRES_DATABASE}
|
||||
user: ${POSTGRES_USER}
|
||||
password: ${POSTGRES_PASSWORD}
|
||||
|
||||
Reference in New Issue
Block a user