diff --git a/ansible/roles/schulcloud-server-init/templates/configmap_file_init.yml.j2 b/ansible/roles/schulcloud-server-init/templates/configmap_file_init.yml.j2 index 4758baec80..0618bf1926 100644 --- a/ansible/roles/schulcloud-server-init/templates/configmap_file_init.yml.j2 +++ b/ansible/roles/schulcloud-server-init/templates/configmap_file_init.yml.j2 @@ -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.