Skip to content

Commit

Permalink
Already CHANNEL check. Sets to #general if null
Browse files Browse the repository at this point in the history
  • Loading branch information
tspicer authored Oct 26, 2016
1 parent 4dcfd01 commit 7de5197
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions slack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
if [[ -n ${WEBHOOK} ]]; then
echo "INFO: The Slack API WEBHOOK was passed via the command line (-w)"
elif [[ -n ${SLACK_WEBHOOK} ]]; then
echo "INFO: The Slack API TOKEN was set as a system variable"
WEBHOOK=${SLACK_WEBHOOK}
echo "INFO: The Slack API TOKEN was set as a system variable"
WEBHOOK=${SLACK_WEBHOOK}
else
echo "INFO: Using default Slack API endpoint to POST messages..."
WEBHOOK=${WEBHOOK-'https://hooks.slack.com/services/'}
Expand Down Expand Up @@ -122,21 +122,6 @@ else
exit 1
fi


# ----------
# Check for CHANNEL
# ----------
# Default CHANNEL to post messages
if [[ -n ${CHANNEL} ]]; then
echo "INFO: The Slack API TOKEN was passed via the command line (-k)"
elif [[ -n ${SLACK_CHANNEL} ]]; then
echo "INFO: The Slack API TOKEN was set as a system variable"
CHANNEL=${SLACK_CHANNEL}
else
echo "ERROR: No Slack API TOKEN was found. Can not proceed with posting messages to the API without one."
exit 1
fi

# ----------
# Service Specific Configurations
# ----------
Expand Down Expand Up @@ -228,4 +213,4 @@ function SEND() {
}

SEND
exit 1
exit 1

0 comments on commit 7de5197

Please sign in to comment.