feat(mongo): Add MongoDB connection support for Boundary CLI PORT (#6069)

* feat(mongo): add mongo for boundary cli

* Fix: remove changes added by mistake during testing

* feat(enos): install MongoDB client (mongosh) in e2e Docker test runtime

* Remove explicit Boundary DB/server startup from target_tcp_connect_mongo_test.go

* Add a full stop and trigger CI

* feat: add mongosh support to boundary connect mongo

* feat: add mongosh support to boundary connect mongo

* feat: add auth-source flag for MongoDB connect command

- Add -auth-source flag with default value 'admin' for root users
- Add BOUNDARY_CONNECT_MONGO_AUTH_SOURCE environment variable support
- Update documentation with new flag and correct mongosh default
- Improve MongoDB test with explicit auth-source parameter
- Fix Docker configuration formatting for better readability

This ensures MongoDB root users authenticate against the admin database
by default while allowing flexibility for custom authentication databases.

* test(e2e): Fixed false positive in Mongo connect test; use UriNetwork and container hostname

* make gen

* fix: Removed unnecessary variable containerName from the MongoDB E2E test

* feat(connect/mongo): Build URI compatible with mongosh and set default authSource

* feat(connect/mongo): use mongosh flags following PostgreSQL pattern

* remove 'connection string' from auth-source usage text

* Update internal/cmd/commands/connect/mongo.go

Co-authored-by: Bharath Gajjala <120367134+bgajjala8@users.noreply.github.com>

* remove 'connection string' from auth-source usage text

* refacotr: replace authSource flag with authenticationDatabase

---------

Co-authored-by: Enbiya <100806254+enbiyagoral@users.noreply.github.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-10-09 11:13:47 -05:00
1 parent b006c47887
commit 4078838f56
10 files changed
+435 -10

No files matched your search

+9 -1
View File
@@ -17,7 +17,8 @@ apt update
# default-mysql-client is used for mysql tests
# wget is used for downloading external dependencies and repository keys
# apt-transport-https enables HTTPS transport for APT repositories
apt install unzip pass lsb-release postgresql-client default-mysql-client wget apt-transport-https -y
# curl and ca-certificates are required for some repository setups (e.g., MongoDB).
apt install unzip pass lsb-release postgresql-client default-mysql-client wget apt-transport-https curl ca-certificates -y
# Function to install Cassandra
install_cassandra() {
@@ -118,6 +119,13 @@ echo \
apt update
apt install docker-ce-cli -y
# Install MongoDB client (mongosh)
# Reference: https://www.mongodb.com/docs/mongodb-shell/install/#debian
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
apt update
apt install -y mongodb-mongosh
# Run Tests
unzip /boundary.zip -d /usr/local/bin/
cd /src/boundary