mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00

* Problem: Source files contain no license info Solution: Add comments with SPDX license info to source files * Python 3 files don't need # -*- coding: utf-8 -*-
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
// Copyright BigchainDB GmbH and BigchainDB contributors
|
|
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
// Code is Apache-2.0 and docs are CC-BY-4.0
|
|
|
|
var configure_adminUser = CONFIGURE_ADMIN_USER;
|
|
var configure_bdbUser = CONFIGURE_BDB_USER;
|
|
var configure_mdbMonUser = CONFIGURE_MDB_MON_USER;
|
|
db = db.getSiblingDB("admin");
|
|
|
|
if (configure_adminUser) {
|
|
db.createUser({
|
|
user: "MONGODB_ADMIN_USERNAME",
|
|
pwd: "MONGODB_ADMIN_PASSWORD",
|
|
roles: [{
|
|
role: "userAdminAnyDatabase",
|
|
db: "admin"
|
|
},
|
|
{
|
|
role: "clusterManager",
|
|
db: "admin"
|
|
}
|
|
]
|
|
});
|
|
}
|
|
if (configure_adminUser && configure_bdbUser) {
|
|
db.auth("MONGODB_ADMIN_USERNAME", "MONGODB_ADMIN_PASSWORD");
|
|
db.getSiblingDB("$external").runCommand({
|
|
createUser: 'BDB_USERNAME',
|
|
writeConcern: {
|
|
w: 'majority',
|
|
wtimeout: 5000
|
|
},
|
|
roles: [{
|
|
role: 'clusterAdmin',
|
|
db: 'admin'
|
|
},
|
|
{
|
|
role: 'readWriteAnyDatabase',
|
|
db: 'admin'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
if (configure_adminUser && configure_mdbMonUser) {
|
|
db.auth("MONGODB_ADMIN_USERNAME", "MONGODB_ADMIN_PASSWORD");
|
|
db.getSiblingDB("$external").runCommand({
|
|
createUser: 'MDB_MON_USERNAME',
|
|
writeConcern: {
|
|
w: 'majority',
|
|
wtimeout: 5000
|
|
},
|
|
roles: [{
|
|
role: 'clusterMonitor',
|
|
db: 'admin'
|
|
}]
|
|
});
|
|
} |