Skip to content

Instantly share code, notes, and snippets.

@koesper
Last active June 26, 2018 14:14
Show Gist options
  • Save koesper/28400bf0cd7b44c2b169ef27e0e06369 to your computer and use it in GitHub Desktop.
Save koesper/28400bf0cd7b44c2b169ef27e0e06369 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
letsencrypt () {
echo "Creating certificates for: " $SPACE_FULL
BACKUP_DIR="$SPACE $(date '+%Y-%m-%d %H:%M:%S')"
mkdir "$BACKUP_DIR"
cp $SPACE.json "$BACKUP_DIR"
bx target -o "####MYCOMPANYACCOUNTNAMEHERE####" -s "$SPACE_FULL"
cp $SPACE.json bluemix-letsencrypt/domains.json
cd bluemix-letsencrypt
python3 setup-app.py
cd ..
mv bluemix-letsencrypt/*.pem "$BACKUP_DIR"
}
menu () {
echo "Lets generate some certificates!"
echo ""
echo "For which space do you want to create the domains?"
echo "--------------------------"
echo "Press 1 for Space1"
echo "Press 2 for Space2"
echo "Press 3 for Space with difficult name"
echo ""
echo "Press x to exit the script"
echo "--------------------------"
# read -p "Input Selection:" SPACE_NR;
echo "For which space do you want to create the domains?"
sleep 0.1
select SPACE in "space1" "space2" "space3" "quit"; do
case $SPACE in
"space1")
SPACE_FULL=$SPACE
letsencrypt;
break;
;;
"space2")
SPACE_FULL=$SPACE
letsencrypt;
break;
;;
"space3")
SPACE_FULL="Space with difficult name" #DIFFERENT FROM THE SHORT NAME!
letsencrypt;
break;
;;
"quit")
echo "Bye!"
exit;
;;
*)
echo "Not a clue what you want... I'm giving up"
exit;
;;
esac
done
}
menu
@koesper
Copy link
Author

koesper commented Jun 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment