captaincore/app/activate
Austin Ginder 825b54016d 📦 NEW: Go CLI
2021-06-24 23:05:07 -04:00

49 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Removes custom deactivate mu-plugin on one or more sites.
#
# `captaincore activate [<site>...]`
#
while read config; do
if [[ "$config" == "Error:"* ]]; then
continue
fi
declare "$config"
done <<< "$(php ${CAPTAINCORE_PATH}/lib/local-scripts/configs.php fetch)"
if [ ${#@} -ne 1 ]; then
echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Please specify a <site>."
exit
fi
site=$1
run_command() {
# Extract environment
if [[ "$website" == *"-staging"* ]]; then
environment=staging
else
environment=production
fi
# Load site configs
while read site_configs; do declare "$site_configs"; done <<< "$(captaincore site get $site --bash --captain-id=$CAPTAIN_ID)"
if [ -z "$domain" ]; then
echo "Domain not found"
continue
fi
rclone_config_file="$path/${site}_${site_id}/rclone.conf"
if [ ! -f "$rclone_config_file" ]; then
captaincore site key-generate $site --captain-id=$CAPTAIN_ID
fi
captaincore ssh $site-$environment --script=activate -- --wp_content=$wp_content
}
run_command