forked from coop-cloud/wekan
50 lines
1.7 KiB
Bash
50 lines
1.7 KiB
Bash
export ENTRYPOINT_VERSION=v4
|
|
|
|
set_settings() {
|
|
mongosh wekan --eval '
|
|
db.settings.updateOne(
|
|
{},
|
|
{
|
|
$set: {
|
|
"disableForgotPassword": true,
|
|
"displayAuthenticationMethod" : false,
|
|
"disableRegistration" : true,
|
|
"customTopLeftCornerLogoImageUrl": "'$LOGO_IMG_URL'",
|
|
"customTopLeftCornerLogoLinkUrl": "'$LOGO_LINK_URL'",
|
|
}
|
|
}
|
|
)'
|
|
}
|
|
|
|
show_mongo_version() {
|
|
mongosh --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
|
|
}
|
|
|
|
update_mongo_version() {
|
|
mongosh --quiet --eval '
|
|
const target = db.version().split(".").slice(0, 2).join(".");
|
|
const command = {setFeatureCompatibilityVersion: target};
|
|
if (parseInt(target, 10) >= 7) command.confirm = true;
|
|
print("set featureCompatibilityVersion to " + target);
|
|
printjson(db.adminCommand(command));
|
|
'
|
|
}
|
|
|
|
normalize_replset_config() {
|
|
mongosh --quiet --eval '
|
|
const local = db.getSiblingDB("local");
|
|
const stored = local.system.replset.findOne();
|
|
if (!stored) { print("no stored replica set configuration"); quit(0); }
|
|
if (db.serverStatus().repl) { // already a set: only a reconfig may write
|
|
const cfg = rs.conf();
|
|
cfg.version = cfg.version + 1;
|
|
printjson(rs.reconfig(cfg));
|
|
} else { // standalone: nobody is using it yet
|
|
stored.members.forEach(m => { delete m.slaveDelay; m.secondaryDelaySecs = 0; m.host = "db:27017"; });
|
|
stored.version = stored.version + 1;
|
|
local.system.replset.replaceOne({_id: stored._id}, stored);
|
|
printjson(local.system.replset.findOne());
|
|
}
|
|
'
|
|
}
|