Skip to content
Snippets Groups Projects
Commit 6fe21cb2 authored by Becker, Christoph's avatar Becker, Christoph
Browse files

Make mongodb auth mechanism configurable.

parent 489e4e94
No related branches found
No related tags found
No related merge requests found
......@@ -63,8 +63,9 @@ func main() {
db, err := mongo.Connect(
context.Background(),
options.Client().ApplyURI(cfg.Mongo.Addr).SetAuth(options.Credential{
Username: cfg.Mongo.User,
Password: cfg.Mongo.Pass,
Username: cfg.Mongo.User,
Password: cfg.Mongo.Pass,
AuthMechanism: cfg.Mongo.AuthMechanism,
}),
)
if err != nil {
......
......@@ -31,9 +31,10 @@ type authConfig struct {
}
type mongoConfig struct {
Addr string `envconfig:"MONGO_ADDR" required:"true"`
User string `envconfig:"MONGO_USER" required:"true"`
Pass string `envconfig:"MONGO_PASS" required:"true"`
Addr string `envconfig:"MONGO_ADDR" required:"true"`
User string `envconfig:"MONGO_USER" required:"true"`
Pass string `envconfig:"MONGO_PASS" required:"true"`
AuthMechanism string `envconfig:"MONGO_AUTH_MECHANISM" default:"SCRAM-SHA-1"`
}
type policyConfig struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment