Browse Source

Minor fixes

pull/1/head
rozetko 6 years ago
parent
commit
7df3103d83
  1. 2
      Dockerfile
  2. 2
      README.md
  3. 1
      package.json
  4. 11
      src/config.ts
  5. 2
      src/index.ts

2
Dockerfile

@ -5,7 +5,7 @@ ARG build_path=/var/www
ENV BUILD_PATH=$build_path
# Expose port 80
EXPOSE 80
EXPOSE 8000
VOLUME [ "/var/www/exported" ]

2
README.md

@ -2,7 +2,7 @@
Server for fetching data from Grafana datasources
Running on 80 port in Docker container.
Running on 8000 port in Docker container.
Dockerfile has 2 volumes:

1
package.json

@ -16,7 +16,6 @@
"express": "^4.16.3",
"fast-csv": "^2.4.1",
"moment": "^2.22.1",
"node-fetch": "^2.1.2",
"nodemon": "^1.17.3",
"ts-loader": "^3.5.0",
"typescript": "^2.8.3",

11
src/config.ts

@ -5,12 +5,7 @@ export const EXPORTED_PATH = path.join(__dirname, '../exported');
export function getApiKey(host) {
return new Promise((resolve, reject) => {
fs.readFile(path.join(__dirname, '../api-keys.json'), 'utf8', (err, data) => {
if(err) {
reject(err);
}
resolve(JSON.parse(data)[host]);
});
});
let data = fs.readFileSync(path.join(__dirname, '../api-keys.json'), 'utf8');
return JSON.parse(data)[host]
}

2
src/index.ts

@ -7,7 +7,7 @@ import * as express from 'express';
import * as bodyParser from 'body-parser';
const app = express();
const PORT = 80;
const PORT = 8000;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

Loading…
Cancel
Save