Skip to content

Commit

Permalink
docs: include MongoDB's username and password options into the docs (#…
Browse files Browse the repository at this point in the history
…1930)

* docs: include mongodb options into the docs

* chore: apply introduced-when string to all markdown files from the docs

* fix: typo
  • Loading branch information
mdelapenya committed Nov 29, 2023
1 parent 8fadbe0 commit 6d1dd3e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
18 changes: 18 additions & 0 deletions docs/modules/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ When starting the MongoDB container, you can pass options in a variadic way to c
If you need to set a different MongoDB Docker image, you can use `testcontainers.WithImage` with a valid Docker image
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

0 comments on commit 6d1dd3e

Please sign in to comment.