
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
ReplicaSet.Aspire.MongoDB
Advanced tools
Provides the ability to create a MongoDB replica set for Aspire.
Use the extension method below to add a replica set to MongoDB when you want to specify the content path, dockerfile to override the location of the key file name
IResourceBuilder<MongoDBServerResource> WithReplicaSet(this IResourceBuilder<MongoDBServerResource> builder, string contextPath, string dockerFile, string keyFileName = "/etc/mongo-keyfile")
Alternatively if you want to use the Mongo.Dockerfile included with this NuGet package, you can use the extension method below. This method will try and locate the Mongo.Dockerfile in the same directory as the executing assembly.
IResourceBuilder<MongoDBServerResource> WithReplicaSet(this IResourceBuilder<MongoDBServerResource> builder)
Use the extension method AddMongoReplicaSet() to add a MongoDB replica set resource to the distributed application builder.
IResourceBuilder<MongoReplicaSetResource> AddMongoReplicaSet(this IDistributedApplicationBuilder builder, string name, IResourceWithConnectionString mongoDbResource)
A full example can be seen below when using the Mongo.Dockerfile provided with an example API Project:
var builder = DistributedApplication.CreateBuilder(args);
var username = builder.AddParameter("mongo-user", "admin");
var password = builder.AddParameter("mongo-password", "admin");
const int port = 27017;
var mongo = builder
.AddMongoDB("mongo", port, username, password)
.WithLifetime(ContainerLifetime.Persistent)
.WithReplicaSet();
var mongodb = mongo
.AddDatabase("mongoDatabase");
var mongoReplicaSet = builder
.AddMongoReplicaSet("mongoDb", mongodb.Resource);
builder.AddProject<AspireMongoReplicaSet_API>("aspiremongoreplicaset-api", "http")
.WithReference(mongodb)
.WithReference(mongoReplicaSet)
.WaitFor(mongodb)
.WaitFor(mongoReplicaSet);
await builder
.Build()
.RunAsync();
FAQs
Add replica set to MongoDB when using Aspire
We found that replicaset.aspire.mongodb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.