-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·43 lines (35 loc) · 962 Bytes
/
run.sh
File metadata and controls
executable file
·43 lines (35 loc) · 962 Bytes
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
#!/bin/sh
if [ -z "$MODULE_PATH" ]; then
echo "MODULE_PATH env var is not defined"
exit 1
fi
echo "Running kommentaar for $MODULE_PATH"
mkdir -p /go/src/$MODULE_PATH
cp -r /code/. /go/src/$MODULE_PATH
config=/config/kommentaar.conf
# check if we should override with env var
if [ -n "$CONFIG_NAME" ]; then
config=/config/$CONFIG_NAME
fi
echo "Config will be loaded from $config"
output_ext="yaml"
output="openapi2-yaml"
if [ -n "$OUTPUT" ]; then
if [ "$OUTPUT" = "openapi2-json" ] || [ "$OUTPUT" = "openapi2-jsonindent" ]; then
output_ext="json"
output="$OUTPUT"
fi
if [ "$OUTPUT" = "html" ]; then
output_ext="html"
output="$OUTPUT"
fi
fi
exec_path=/go/src/$MODULE_PATH/...
if [ -n "$EXEC_PATH" ]; then
exec_path=$EXEC_PATH
fi
echo "Kommentaar will be executed against $exec_path"
export GOPATH=/go
export GO111MODULE=off
cd /go/src/$MODULE_PATH
/go/bin/kommentaar -config $config -output $output $exec_path > /output/swagger.$output_ext