Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: include MongoDB's username and password options into the docs #1930

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/modules/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,27 @@ When starting the MongoDB container, you can pass options in a variadic way to c

#### Image

If you need to set a different MongoDB Docker image, you can use `testcontainers.WithImage` with a valid Docker image
If you need to set a different MongoDB Docker image, you can use `testcontainers.WithUsername` with a valid Docker image
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
for MongoDB. E.g. `testcontainers.WithImage("mongo:6")`.

#### WithUsername

- Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>

This functional option sets the initial username to be created when the container starts.
It is used in conjunction with `WithPassword` to set a username and its password, creating the specified user with superuser power.

E.g. `testcontainers.WithUsername("mymongouser")`.

#### WithPassword

- Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>

This functional option sets the initial password to be created when the container starts.
It is used in conjunction with `WithUsername` to set a username and its password, setting the password for the superuser power.

E.g. `testcontainers.WithPassword("mymongopwd")`.

{% include "../features/common_functional_options.md" %}

### Container Methods
Expand Down
2 changes: 1 addition & 1 deletion modules/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func WithUsername(username string) testcontainers.CustomizeRequestOption {

// WithPassword sets the initial password of the user to be created when the container starts
// It is used in conjunction with WithUsername to set a username and its password.
// This environment variable sets the superuser password for MongoDB.
// It will set the superuser password for MongoDB.
func WithPassword(password string) testcontainers.CustomizeRequestOption {
return func(req *testcontainers.GenericContainerRequest) {
req.Env["MONGO_INITDB_ROOT_PASSWORD"] = password
Expand Down
15 changes: 3 additions & 12 deletions scripts/pre-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ function bumpVersion() {
make "tidy-${directory}"
done

cd "${ROOT_DIR}/docs/modules"
cd "${ROOT_DIR}/docs"

versionEscapingDots="${versionToBumpWithoutV/./\.}"
NON_RELEASED_STRING='Not available until the next release of testcontainers-go <a href=\"https:\/\/github.com\/testcontainers\/testcontainers-go\"><span class=\"tc-version\">:material-tag: main<\/span><\/a>'
RELEASED_STRING="Since testcontainers-go <a href=\\\"https:\/\/github.com\/testcontainers\/testcontainers-go\/releases\/tag\/v${versionEscapingDots}\\\"><span class=\\\"tc-version\\\">:material-tag: v${versionEscapingDots}<\/span><\/a>"

# Update the since-version in those modules that were added in the current version
ls | grep -v "index.md" | while read -r module_file; do
# find all markdown files, and for each of them, replace the release string
find . -name "*.md" | while read -r module_file; do
if [[ "${DRY_RUN}" == "true" ]]; then
echo "sed \"s/${NON_RELEASED_STRING}/${RELEASED_STRING}/g\" ${module_file} > ${module_file}.tmp"
echo "mv ${module_file}.tmp ${module_file}"
Expand All @@ -87,15 +87,6 @@ function bumpVersion() {
mv ${module_file}.tmp ${module_file}
fi
done

readonly commonFile="${ROOT_DIR}/docs/features/common_functional_options.md"
if [[ "${DRY_RUN}" == "true" ]]; then
echo "sed \"s/${NON_RELEASED_STRING}/${RELEASED_STRING}/g\" ${commonFile} > ${commonFile}.tmp"
echo "mv ${commonFile}.tmp ${commonFile}"
else
sed "s/${NON_RELEASED_STRING}/${RELEASED_STRING}/g" ${commonFile} > ${commonFile}.tmp
mv ${commonFile}.tmp ${commonFile}
fi
}

# This function reads the version.go file and extracts the current version.
Expand Down