Update sync.sh

simplify secrets to only have one: the API key
This commit is contained in:
Andrew Hurley 2022-07-19 19:45:24 +08:00 committed by GitHub
parent 36c40d551c
commit b5621d1fe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 22 deletions

24
sync.sh
View File

@ -22,31 +22,11 @@ if [[ -z "$SSLMATE_API_KEY" ]]; then
exit 1 exit 1
fi fi
if [ ! -d /etc/sslmate/keys ]; then
mkdir -p /etc/sslmate/keys
fi
if [ ! -d /etc/sslmate/certs ]; then
mkdir -p /etc/sslmate/certs
fi
# COPY secret keys to keys dir
# NOTE: /etc/sslmate needs to be a named volume so key is not stored in image
for FILE in /run/secrets/*domain_*; do
if [[ ! -f ${FILE} ]]; then
echo "Cannot find secrets";
exit 1;
fi
FNAME=${FILE##*_}
echo "Secret file $FILE found. Copying to /etc/sslmate/keys/${FNAME}"
cp "${FILE}" "/etc/sslmate/keys/${FNAME}"
done
if [ ! -f /etc/sslmate.conf ]; then if [ ! -f /etc/sslmate.conf ]; then
cat > /etc/sslmate.conf <<EOF cat > /etc/sslmate.conf <<EOF
api_key ${SSLMATE_API_KEY} api_key ${SSLMATE_API_KEY}
key_directory /etc/sslmate/keys key_directory /etc/sslmate/
cert_directory /etc/sslmate/certs cert_directory /etc/sslmate/
cert_format.chained yes cert_format.chained yes
cert_format.combined yes cert_format.combined yes
cert_format.root yes cert_format.root yes