|
@ -29,9 +29,14 @@ local_path_key=/etc/rsync/keys |
|
|
host_path_key="$SERVICE_CONFIGSTORE${local_path_key}" |
|
|
host_path_key="$SERVICE_CONFIGSTORE${local_path_key}" |
|
|
key_nb=0 |
|
|
key_nb=0 |
|
|
|
|
|
|
|
|
volume_keys=() |
|
|
|
|
|
all_keys=" " |
|
|
|
|
|
|
|
|
## ident are unique by construction (they are struct keys) |
|
|
|
|
|
## but keys need to be also unique |
|
|
|
|
|
declare -A keys |
|
|
while read-0 ident key; do |
|
|
while read-0 ident key; do |
|
|
|
|
|
if [ "${keys[$key]}" ]; then |
|
|
|
|
|
err "Duplicate key: key for ident '$ident' is same as ident '${keys["$key"]}'." |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
if ! [[ "$ident" =~ ^[a-zA-Z0-9._-]+$ ]]; then |
|
|
if ! [[ "$ident" =~ ^[a-zA-Z0-9._-]+$ ]]; then |
|
|
err "Invalid identifier '$ident'," \ |
|
|
err "Invalid identifier '$ident'," \ |
|
|
"please use only alphanumerical char, dots, dash or underscores." |
|
|
"please use only alphanumerical char, dots, dash or underscores." |
|
@ -39,10 +44,9 @@ while read-0 ident key; do |
|
|
fi |
|
|
fi |
|
|
debug "Creating access key for ${ident}" || true |
|
|
debug "Creating access key for ${ident}" || true |
|
|
echo "$key" | file_put "$host_path_key/${ident}.pub" |
|
|
echo "$key" | file_put "$host_path_key/${ident}.pub" |
|
|
|
|
|
keys["$key"]="$ident" |
|
|
done < <(echo "$keys" | shyaml key-values-0) |
|
|
done < <(echo "$keys" | shyaml key-values-0) |
|
|
|
|
|
|
|
|
volume_keys+=("$host_path_key:$local_path_key:ro") |
|
|
|
|
|
|
|
|
|
|
|
init-config-add "\ |
|
|
init-config-add "\ |
|
|
$SERVICE_NAME: |
|
|
$SERVICE_NAME: |
|
|
volumes: |
|
|
volumes: |
|
|