Backend: Begin issue API

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-01-30 21:18:21 +00:00
parent f6a6beb61a
commit b21ac8d562
3 changed files with 24 additions and 2 deletions

View File

@ -83,6 +83,7 @@ The app is designed to be run within Kubernetes or within a Docker container, as
|OWL_LDB_CORPUSUSER||YES|Network Rail CORPUS API Username|
|OWL_LDB_CORPUSPASS||YES|Network Rail CORPUS API Password|
|OWL_GIT_ISSUEBOT||NO|Gitea API Key for issue reporting|
|OWL_GIT_APIENDPOINT||NO|Gitea API Endpoint|
In the case that OWL_LDB_SVKEY is not available, staff versions of departure board, etc. will not be available.

View File

@ -0,0 +1,21 @@
const axios = require('axios')
async function sendToGitea(body) {
let key = process.env.OWL_GIT_ISSUEBOT
let url = process.env.OWL_GIT_APIENDPOINT
let options = {
method: 'post',
timeout: 2000,
headers: {
Accept: 'application/json',
Authorization: key
},
data: body
}
await axios.post(url, options)
}
module.exports = {
sendToGitea
}