Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithKeyFile

Method
📦 Aspire.Hosting.MongoDB v17.0.0
func (MongoDBServerResource) WithKeyFile(
keyValue ExpressionValue,
options ...*WithKeyFileOptions,
) MongoDBServerResource

Signature

methodWithKeyFilebuilder
Sets up a keyfile for internal authentication between members of a MongoDB replica set, with the specified keyValue as the content of the file.
WithKeyFile(
keyValue ExpressionValue,
options ...*WithKeyFileOptions,
) MongoDBServerResource
keyValueExpressionValueThe content of the keyfile. This is a shared secret: every member of the replica set has to be given the same value, and anything holding it can authenticate as a member of the cluster.
options...*WithKeyFileOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithKeyFileOptions argument.

KeyFilePath*stringThe absolute path the keyfile is mounted at inside the container, which has to include a file name. Defaults to /etc/rs.key.
MongoDBServerResource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types: