-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use username & password (from env vars) for Mongo #336
Conversation
Mongo connections can now use a username and password, specified by enviornment variables. If the environment variables are not present or are empty, then no authentication parameters are sent to Mongo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Robin said he tested it locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool! hopefully we can secure mongo soon
mainDatabaseName = Settings.MongoMainDatabaseName; | ||
client = new Lazy<IMongoClient>(GetNewConnection); | ||
dbs = new ConcurrentDictionary<string, IMongoDatabase>(); | ||
} | ||
|
||
private MongoClient GetNewConnection() | ||
{ | ||
var clientSettings = new MongoClientSettings(); | ||
var clientSettings = MongoClientSettings.FromConnectionString(connectionString); | ||
// clientSettings.WriteConcern = WriteConcern.WMajority; // If increasing the wait queue size still doesn't help, try this as well | ||
clientSettings.WaitQueueSize = 50000; | ||
clientSettings.Server = new MongoServerAddress(Settings.MongoHostname, Settings.MongoPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this line still relevant considering the port and host are in the connection string now?
Mongo connections can now use a username and password, specified by enviornment variables. If the environment variables are not present or are empty, then no authentication parameters are sent to Mongo.
Env vars used to specify the username and password will be
LFMERGE_MONGO_USER
andLFMERGE_MONGO_PASS
, matching the convention used for other LfMerge env vars.LFMERGE_MONGO_AUTHSOURCE
can also optionally be set to give the name of the MongoDB database where authentication is stored (default isadmin
and will probably not need changing).Part of sillsdev/web-languageforge#1787, but closing this PR should not close that issue. The linked PR in the LF repo will be the one to close that issue.