Backend: Begin issue API
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
f6a6beb61a
commit
b21ac8d562
@ -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.
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
// extract() : Extract the CORPUS JSON file from the GZIP file.
|
||||
// clean() : Cleans the CORPUS data, removing unneccesary non-stations from the data.
|
||||
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
const log = require('../utils/log.utils'); // Log Helper
|
||||
|
||||
const axios = require('axios')
|
||||
const gz = require('node-gzip')
|
||||
@ -22,7 +22,7 @@ async function subset(allCorpus) {
|
||||
return cleanCorpus
|
||||
}
|
||||
|
||||
async function get(){
|
||||
async function get() {
|
||||
var gzipData = await fetch()
|
||||
var allCorpus = await extract(gzipData)
|
||||
return allCorpus
|
||||
|
21
src/services/issue.services.js
Normal file
21
src/services/issue.services.js
Normal 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
|
||||
}
|
Reference in New Issue
Block a user