Commit 5a85c190 authored by Anastasios Kalogeropoulos's avatar Anastasios Kalogeropoulos
Browse files

environment variables added

parent 8dfd8ff1
PORT=the-port-of-the-server
SLACK_APP_PORT=the-port-of-the-server
FACILITATOR_STATUS_HANDLER_PORT=port-of-the-facilitator-status-handler
BOT_OATH_TOKEN=your-bot-use-oauth-access-token
OATH_TOKEN=your-oath-access-token
CHANNEL=the-channel-id, e.g. C012AB3CD for a general channel
\ No newline at end of file
CHANNEL=the-channel-id, e.g. C012AB3CD for a general channel
UHH_IDEA_DB_URL=url-of-the-experiment-ideadb
\ No newline at end of file
const axios = require('axios');
const {uhhIdeaDB} = require('./config');
class APIService {
constructor() {
this.uhhIdeaDB = 'https://civitasdigitalis.fortiss.org/experiment-uhh/ideadb/idea/';
// this.uhhIdeaDB = 'https://civitasdigitalis.fortiss.org/experiment-uhh/ideadb/idea/';
}
getIdeaById(id) {
return axios.get(this.uhhIdeaDB + `byId?id=${id}`)
return axios.get(uhhIdeaDB + `byId?id=${id}`)
.then(response => {
let received_idea = response.data;
console.log(received_idea);
......@@ -27,7 +28,7 @@ class APIService {
idea["keywords"] = keywords;
idea["conversation_history"] = history;
axios.put(`${this.uhhIdeaDB}update`, idea).then(function (response) {
axios.put(`${uhhIdeaDB}update`, idea).then(function (response) {
console.log("Idea updated successfully");
})
.catch(function (error) {
......
module.exports = {
port: process.env.PORT,
port: process.env.SLACK_APP_PORT,
facilitatorStatusHandlerPort: process.env.FACILITATOR_STATUS_HANDLER_PORT,
botOathToken: process.env.BOT_OATH_TOKEN,
oathToken: process.env.OATH_TOKEN,
channel: process.env.CHANNEL
channel: process.env.CHANNEL,
uhhIdeaDB: process.env.UHH_IDEA_DB_URL
};
\ No newline at end of file
const {facilitatorStatusHandlerPort} = require('./config');
const express = require('express')
const cors = require('cors')
const bodyParser = require('body-parser');
const app = express()
const port = 2999
app.use(bodyParser.json());
app.use(cors())
......@@ -34,4 +33,4 @@ app.post('/facilitator/newStatus', cors(), (req, res) => {
}
})
app.listen(port, () => console.log(`Facilitator status handler listening on port ${port}!`))
\ No newline at end of file
app.listen(facilitatorStatusHandlerPort, () => console.log(`Facilitator status handler listening on port ${facilitatorStatusHandlerPort}!`))
\ No newline at end of file
......@@ -4,7 +4,7 @@
"description": "",
"main": "slack-server.js",
"scripts": {
"start": "concurrently \"node -r dotenv/config slack-server.js\" \"node facilitator-status-handler.js\" ",
"start": "concurrently \"node -r dotenv/config slack-server.js\" \"node -r dotenv/config facilitator-status-handler.js\" ",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment