diff --git a/README.md b/README.md index ebbdb17..0a92818 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/services/corpus.services.js b/src/services/corpus.services.js index 2b9f981..7f04a95 100644 --- a/src/services/corpus.services.js +++ b/src/services/corpus.services.js @@ -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 diff --git a/src/services/issue.services.js b/src/services/issue.services.js new file mode 100644 index 0000000..eeab6ad --- /dev/null +++ b/src/services/issue.services.js @@ -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 +} \ No newline at end of file