-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·216 lines (176 loc) · 7.32 KB
/
setup.sh
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/usr/bin/env bash
# =========================================================
SYNOPSIS="
NAME
setup.sh
SYNOPSIS
setup.sh [-h] \\
[-U <pfbridgeUrl>] \\
[-P <pflinkUrl>] \\
[-v <vaultKey>] \\
[-u <cubeUsername>] \\
[-p <cubePassword>] \\
[-o <orthancUsername>] \\
[-r <orthancPassword>] \\
DESC
setup.sh is a helper script to override various Base
Settings inside pfbridge such as service endpoints of
pflink and analysis related settings such as username
and password of CUBE and orthanc. We can also define
new analysis function and configure values to keys
such as plugin name, version, args; feed name and
pipeline
ARGS
[-h]
If specified, print this synapsis text of setup.sh.
[-U <pfbridgeUrl>]
If specified, uses this url (complete service address)
as service address to submit curl requests to pfbridge.
Default value is http://localhost:33333/api/v1.
[-P <pflinkUrl>]
If specified, use this url (complete service address)
to override existing pflink urls in the base settings.
Default value is http://localhost:8050/api/v1.
[-v <vaultKey>]
If specified, use this combination as a vault key
to get/set various analysis related settings.
Default value is 1234.
[-u <cubeUsername>]
If specified, use this string to set CUBE username.
Default value is 'chris'.
[-p <cubePassword>]
If specified, use this string to set CUBE password.
Default value is 'chris1234'.
[-o <orthancUsername>]
If specified, use this string to set orthanc username.
Default value is 'orthanc'.
[-r <orthancPassword>]
If specified, use this string to set orthanc password.
Default value is 'orthanc'.
EXAMPLES
$ ./setup.sh -U http://localhost:33333/api/v1 \\
-P http://localhost:8050/api/v1 \\
-v 1234 \\
-u chris \\
-p chris1234 \\
-o orthanc \\
-r orthanc \\
-n default \\
-l pl-simpledsapp \\
-f default-%PatientID-%SeriesInstanceUID-%SeriesDescription
"
# =========================================================
# STEP 0: CONFIGURATION
# =========================================================
#
#
URL='http://localhost:33333/api/v1'
PFLINK_URL='http://localhost:8050/api/v1'
VAULTKEY='1234'
USERNAMECUBE='chris'
PASSWORDCUBE='chris1234'
USERNAMEORTHANC='orthanc'
PASSWORDORTHANC='orthanc'
NAME='default'
FEEDNAME="$NAME-%PatientID-%SeriesInstanceUID-%SeriesDescription"
PLUGIN='pl-simpledsapp'
VERSION='2.1.0'
ARGS=''
PIPELINE=''
while getopts "U:P:v:u:p:o:r:n:l:f:s:a:e:h" opt; do
case $opt in
h) printf "%s" "$SYNOPSIS"; exit 1 ;;
U) URL=$2 ;;
P) PFLINK_URL=$OPTARG ;;
v) VAULTKEY=$OPTARG ;;
u) USERNAMECUBE=$OPTARG ;;
p) PASSWORDCUBE=$OPTARG ;;
o) USERNAMEORTHANC=$OPTARG ;;
r) PASSWORDORTHANC=$OPTARG ;;
n) NAME=$OPTARG ;;
l) PLUGIN=$OPTARG ;;
f) FEEDNAME=$OPTARG ;;
s) VERSION=$OPTARG ;;
a) ARGS=$OPTARG ;;
e) PIPELINE=$OPTARG ;;
*) exit 0 ;;
esac
done
#
# =========================================================
echo "STEP 1: CURL request to update existing pflink test URL"
# =========================================================
curl -s -X 'PUT' \
"$URL/pflink/testURL/?URL=$PFLINK_URL/testing" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 2: CURL request to update existing pflink prod URL"
# =========================================================
curl -s -X 'PUT' \
"$URL/pflink/prodURL/?URL=$PFLINK_URL/workflow" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 3: CURL request to update existing pflink auth URL"
# =========================================================
curl -s -X 'PUT' \
"$URL/pflink/authURL/?URL=$PFLINK_URL/auth-token" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 4: CURL request to set the vault key"
# =========================================================
curl -s -X 'PUT' \
"$URL/vaultKey/?key=$VAULTKEY" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 5: CURL request to set CUBE credentials"
# =========================================================
curl -s -X 'POST' \
"$URL/credentials/CUBE/?vaultKey=$VAULTKEY" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"username": "'$USERNAMECUBE'",
"password": "'$PASSWORDCUBE'"
}' | jq
# =========================================================
echo "STEP 6: CURL request to set orthanc credentials"
# =========================================================
curl -s -X 'POST' \
"$URL/credentials/Orthanc/?vaultKey=$VAULTKEY" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"username": "'$USERNAMEORTHANC'",
"password": "'$PASSWORDORTHANC'"
}' | jq
# =========================================================
echo "STEP 7: CURL request to set analysis feed name"
# =========================================================
curl -s -X 'PUT' \
"$URL/analysis/?analysis_name=$NAME&key=analysisFeedName&value=$FEEDNAME" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 8: CURL request to set analysis plugin name"
# =========================================================
curl -s -X 'PUT' \
"$URL/analysis/?analysis_name=$NAME&key=analysisPluginName&value=$PLUGIN" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 9: CURL request to set analysis plugin version"
# =========================================================
curl -s -X 'PUT' \
"$URL/analysis/?analysis_name=$NAME&key=analysisPluginVersion&value=$VERSION" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 10: CURL request to set analysis plugin args"
# =========================================================
curl -s -X 'PUT' \
"$URL/analysis/?analysis_name=$NAME&key=analysisPluginArgs&value=$ARGS" \
-H 'accept: application/json' | jq
# =========================================================
echo "STEP 11: CURL request to set analysis pipeline name"
# =========================================================
curl -s -X 'PUT' \
"$URL/analysis/?analysis_name=$NAME&key=analysisPipelineName&value=$PIPELINE" \
-H 'accept: application/json' | jq
# =========================================================