-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcli.sh
More file actions
executable file
·81 lines (73 loc) · 1.86 KB
/
cli.sh
File metadata and controls
executable file
·81 lines (73 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Function to display usage information
function show_usage {
echo "Usage: $0 [OPTIONS]"
echo "Manage Keycloak Docker container"
echo ""
echo "Options:"
echo " --start Start the Keycloak container"
echo " --stop Stop and remove the Keycloak container (including volumes)"
echo " --dev Start Keycloak configurator via maven in dev mode"
echo " --help Display this help message"
echo ""
echo "Example: $0 --start"
}
# Function to start Keycloak container
function start_keycloak {
echo "Starting Keycloak container..."
docker compose up -d keycloak --wait
# Check if container is running
if docker ps | grep -q keycloak; then
echo "Keycloak container is now running"
else
echo "Error: Failed to start Keycloak container"
exit 1
fi
}
# Function to stop and remove Keycloak container
function stop_keycloak {
echo "Stopping Keycloak container..."
if docker ps -a | grep -q keycloak; then
echo "Removing Keycloak container and volumes..."
docker compose down --volumes --remove-orphans
else
echo "Keycloak container is not running"
fi
}
# Function to start Keycloak configurator in dev mode
function start_dev {
echo "Starting Keycloak configurator in dev mode..."
mvn quarkus:dev -Dquarkus.args="configure -s http://localhost:8080 -u keycloak -p root -c ./src/test/resources/configuration -t client-role" -Dgithub
}
# Check if no arguments were provided
if [ $# -eq 0 ]; then
show_usage
exit 1
fi
# Process command line arguments
while [ $# -gt 0 ]; do
case "$1" in
--start)
start_keycloak
shift
;;
--stop)
stop_keycloak
shift
;;
--dev)
start_dev
shift
;;
--help)
show_usage
exit 0
;;
*)
echo "Unknown option: $1"
show_usage
exit 1
;;
esac
done
exit 0