11#! /usr/bin/env bash
22set -euo pipefail
33
4+ # Default values
45IMAGE=" ghcr.io/evolvus/github-smart:latest"
56APP_NAME=" github-smart-app"
67MYSQL_NAME=" github-smart-mysql"
8+ GITHUB_ORG=" "
9+ GITHUB_TOKEN=" "
10+
11+ # Parse command line arguments
12+ while [[ $# -gt 0 ]]; do
13+ case $1 in
14+ -o|--org)
15+ GITHUB_ORG=" $2 "
16+ shift 2
17+ ;;
18+ -t|--token)
19+ GITHUB_TOKEN=" $2 "
20+ shift 2
21+ ;;
22+ -p|--port)
23+ APP_PORT=" $2 "
24+ shift 2
25+ ;;
26+ -h|--help)
27+ echo " Usage: $0 [-o|--org ORGANIZATION] [-t|--token TOKEN] [-p|--port PORT]"
28+ echo " "
29+ echo " Options:"
30+ echo " -o, --org ORGANIZATION GitHub organization name (required for API testing)"
31+ echo " -t, --token TOKEN GitHub personal access token (required for API testing)"
32+ echo " -p, --port PORT Application port (default: 8081)"
33+ echo " -h, --help Show this help message"
34+ echo " "
35+ echo " Examples:"
36+ echo " $0 -o Syneca -t ghp_xxxxxxxxxxxxxxxxxxxx"
37+ echo " $0 --org Syneca --token ghp_xxxxxxxxxxxxxxxxxxxx --port 9090"
38+ echo " $0 # Run without GitHub integration"
39+ exit 0
40+ ;;
41+ * )
42+ echo " Unknown option: $1 "
43+ echo " Use -h or --help for usage information"
44+ exit 1
45+ ;;
46+ esac
47+ done
748
849
950
@@ -61,6 +102,7 @@ docker run -d \
61102 -e DB_USER=${DB_USER:- github_smart_user} \
62103 -e DB_PASSWORD=${DB_PASSWORD:- github_smart_password} \
63104 -e GITHUB_TOKEN=${GITHUB_TOKEN:- } \
105+ -e GITHUB_ORG=${GITHUB_ORG:- } \
64106 -v github-smart-logs:/var/www/html/logs \
65107 --link ${MYSQL_NAME} :mysql \
66108 " $IMAGE "
@@ -76,7 +118,7 @@ for i in {1..30}; do
76118done
77119
78120echo " Testing GitHub issues API..."
79- if [ -n " ${GITHUB_TOKEN:- } " ]; then
121+ if [ -n " ${GITHUB_TOKEN} " ]; then
80122 echo " GitHub token provided, testing API call..."
81123 api_response=$( curl -s -X POST http://localhost:${APP_PORT:- 8081} /api/getGHIssues.php 2> /dev/null || echo " API call failed" )
82124 if echo " $api_response " | grep -q " success\|issues\|data\|GitHub API token not configured" ; then
@@ -94,7 +136,7 @@ if [ -n "${GITHUB_TOKEN:-}" ]; then
94136 fi
95137else
96138 echo " ℹ️ No GitHub token provided, skipping API test"
97- echo " ℹ️ To test GitHub integration, set GITHUB_TOKEN environment variable "
139+ echo " ℹ️ To test GitHub integration, use: $0 -o ORGANIZATION -t TOKEN "
98140fi
99141
100142echo " 🎉 Deployment completed successfully!"
0 commit comments