captaincore/app/configs
2019-04-08 20:12:33 -04:00

30 lines
No EOL
830 B
Bash
Executable file

#!/usr/bin/env bash
#
# Updates configurations for CaptainCore
#
# `captaincore configs <action> [<keys|remotes|vars>] [<name>]`
#
# `captaincore configs update-websites`
#
# Load configuration
root_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; root_path=${root_path%app*}
source ${root_path}lib/arguments
action=$1
key=$2
name=$3
value=$4
if [[ "$action" == "fetch" ]]; then
php ${root_path}lib/local-scripts/configs.php fetch $key $name $value --captain_id=$captain_id --format=json
fi
if [[ "$action" == "update-websites" ]]; then
php ${root_path}lib/local-scripts/configs.php update vars websites "$(captaincore site list @all --captain_id=$captain_id)" --captain_id=$captain_id
fi
if [ ${#arguments[*]} -eq 0 ]; then
echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Please specify an <action>."
fi