Skip to content

Commit

Permalink
BC-8438 - fix secret handling for CTL tools
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Nov 19, 2024
1 parent 146f6a0 commit 7fab6a5
Showing 1 changed file with 44 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,43 +519,51 @@ data:
# ========== Start of the CTL seed data configuration section.
echo "Inserting ctl seed data secrets to external-tools..."

if [ -n "$CTL_SEED_SECRET_ONLINE_DIA_MATHE" ]; then
# Encrypt secrets of external tools that contain an lti11 config.
CTL_SEED_SECRET_ONLINE_DIA_MATHE=$(node scripts/secret.js -s $AES_KEY -e $CTL_SEED_SECRET_ONLINE_DIA_MATHE)
CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH=$(node scripts/secret.js -s $AES_KEY -e $CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH)

mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Product Test Onlinediagnose Grundschule - Mathematik",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_ONLINE_DIA_MATHE'",
} },
{
"upsert": true
}
);'
mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Product Test Onlinediagnose Grundschule - Deutsch",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH'",
} },
{
"upsert": true
}
);'
mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Merlin Bibliothek",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_MERLIN'",
} },
{
"upsert": true
}
);'
CTL_SEED_SECRET_ONLINE_DIA_MATHE=$(node scripts/secret.js -s $AES_KEY -e $CTL_SEED_SECRET_ONLINE_DIA_MATHE)
mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Product Test Onlinediagnose Grundschule - Mathematik",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_ONLINE_DIA_MATHE'",
} },
{
"upsert": true
}
);'
fi
if [ -n "$CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH" ]; then
# Encrypt secrets of external tools that contain an lti11 config.
CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH=$(node scripts/secret.js -s $AES_KEY -e $CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH)
mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Product Test Onlinediagnose Grundschule - Deutsch",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_ONLINE_DIA_DEUTSCH'",
} },
{
"upsert": true
}
);'
fi
if [ -n "$CTL_SEED_SECRET_MERLIN" ]; then
# Encrypt secrets of external tools that contain an lti11 config.
CTL_SEED_SECRET_MERLIN=$(node scripts/secret.js -s $AES_KEY -e $CTL_SEED_SECRET_MERLIN)
mongosh $DATABASE__URL --quiet --eval 'db.getCollection("external-tools").updateOne(
{
"name": "Merlin Bibliothek",
},
{ $set: {
"config_secret": "'$CTL_SEED_SECRET_MERLIN'",
} },
{
"upsert": true
}
);'
fi
echo "Inserted ctl seed data secrets to external-tools."

# ========== End of the CTL seed data configuration section.
Expand Down

0 comments on commit 7fab6a5

Please sign in to comment.