What is the most elegant way to trigger a change in a relation .. via an action? [bash charm]

I am writing an action to modify something which… is part of a charms config… namely a set of domain names

I have an action called add-domain , via a .sh file… and I noticed that it appears I will need to pull down, parse, and run in a loop… over all the relation ids… an update to the configs variable

is there a more elegant way than this ?

#!/bin/bash
unit_num=$(echo $JUJU_UNIT_NAME | cut -d'/' -f 2)

new_domain=$(action-get new-domain)

juju-log -l 'WARNING' "(add-domain) Adding a new domain $new_domain"
status-set maintenance "setup a new domain $new_domain $(date +"%H:%M")"

OLD_CONFIG="$(config-get mahrio_config)"
juju-log -l 'WARNING' "(add-domain) OLD_CONFIG $OLD_CONFIG"

NEW_CONFIG="${OLD_CONFIG}
${new_domain}"
juju-log -l 'WARNING' "(add-domain) NEW_CONFIG $NEW_CONFIG"

list_of_relation_ids=$(relation-ids website)
if [ -z "$list_of_relation_ids" ]; then
  juju-log -l 'WARNING' "list_of_relation_ids is empty"
  status-set maintenance "(u) You need to relate this unit to a consumer of website $(date +"%H:%M")"
  exit
fi

juju-log -l 'WARNING' "list_of_relation_ids $list_of_relation_ids"

# THIS PART DOESN'T WORK YET, NEED TO ITERATE  OVER ALL IDs PROPERLY
relation-set -r $list_of_relation_ids mahrio_config=$NEW_CONFIG

status-set active "exiting... $(date +"%H:%M")"
juju-log -l "WARNING" "(add-domain) exiting..."

I am basing this off of this “old” doc… Juju documentation | Juju documentation

I’ve tried this just now… but getting an error… based on the docs I cannot see what is wrong

list_of_relation_ids=$(relation-ids website)

while IFS= read -r line; do
  juju-log -l 'WARNING ' "... $line ..."
  relation-set -r $line mahrio_config=$NEW_CONFIG
done <<< "$list_of_relation_ids"

the output from juju debug-log

unit-mahrio-9: 20:13:07 INFO unit.mahrio/9.juju-log ... website:18 ...
unit-mahrio-9: 20:13:07 WARNING unit.mahrio/9.add-domain ERROR expected "key=value", got "adomain.com"

unit-mahrio-9: 20:13:07 INFO unit.mahrio/9.juju-log ... website:19 ...
unit-mahrio-9: 20:13:07 WARNING unit.mahrio/9.add-domain ERROR expected "key=value", got "oneofmydomains.com"

edit: it could be I need to wrap the variable I am assigning in ""s , yea that was it… the relations were triggered! sweet

but one question… I now have the updated hook tools list

and I notice there is no set-config command … how would I go about updating my charms config via action … or is that an anti pattern?