#!/bin/sh

set -e

systemctl stop xc_cdn.service

TEMPFILE=$(mktemp)
jq 'del(.biz_id)' /etc/pear/pear_monitor/node_info.json >"$TEMPFILE"
install -m0644 "$TEMPFILE" /etc/pear/pear_monitor/node_info.json

STORAGE_DIRS=$(jq -rM '.storage[]' /etc/pear/pear_monitor/config.json)
for D in ${STORAGE_DIRS}; do
    rm -rf "$D"/user.ini.enc
done

systemctl start xc_cdn.service
