Skip to content

Commit 36d941b

Browse files
committed
Docker-Compose angepasst
1 parent 86dc6f7 commit 36d941b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ IMAP_USER=
55
IMAP_PASSWORD=
66
JIRA_USER=
77
JIRA_PASSWORD=
8-
JIRA_URL=
8+
JIRA_URL=
9+
JIRA_API_VERSION=2

service/cmd/server/main.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func run() {
111111
imapServerPort := os.Getenv("IMAP_PORT")
112112
imapUser := os.Getenv("IMAP_USER")
113113
imapPassword := os.Getenv("IMAP_PASSWORD")
114+
jiraApiVersion := os.Getenv("JIRA_API_VERSION")
114115

115116
// Connect to server
116117
c, err := client.DialTLS(imapServer+":"+imapServerPort, nil)
@@ -199,12 +200,12 @@ func run() {
199200

200201
issueNumber := subject[strings.LastIndex(subject, "[")+1 : strings.LastIndex(subject, "]")]
201202

202-
resp := makeGetRequest("/rest/api/3/issue/" + issueNumber)
203+
resp := makeGetRequest("/rest/api/" + jiraApiVersion + "/issue/" + issueNumber)
203204

204205
if resp.StatusCode != 200 {
205206
printErrorFromApi(resp)
206207
} else {
207-
resp := makePostRequest("/rest/api/3/issue/"+issueNumber+"/comment", jsonString)
208+
resp := makePostRequest("/rest/api/"+jiraApiVersion+"/issue/"+issueNumber+"/comment", jsonString)
208209

209210
if resp.StatusCode != 201 {
210211
printErrorFromApi(resp)
@@ -225,7 +226,9 @@ func run() {
225226
jsonString = strings.Replace(jsonString, "%SUMMARY%", subject, 1)
226227
jsonString = strings.Replace(jsonString, "%DESCRIPTION%", strings.TrimSpace(sanitizedBody), 1)
227228

228-
resp := makePostRequest("/rest/api/3/issue", jsonString)
229+
log.Println(jsonString)
230+
231+
resp := makePostRequest("/rest/api/"+jiraApiVersion+"/issue", jsonString)
229232

230233
if resp.StatusCode != 201 {
231234
printErrorFromApi(resp)

structure_new_issue.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"fields":{"project":{"key":"TES"},"summary":"%SUMMARY%","description":{"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"text":"%DESCRIPTION%","type":"text"}]}]},"issuetype":{"name":"Task"}}}
1+
{"fields":{"project":{"key":"TES"},"summary":"%SUMMARY%","description":"%DESCRIPTION%","issuetype":{"name":"Task"}}}

0 commit comments

Comments
 (0)