backend: Read mtgox-weekly.json from dist

This commit is contained in:
Erik Arvstedt 2022-07-13 12:44:31 +02:00
parent 8f0fc3af57
commit 5683f639ed
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 3 additions and 2 deletions

View file

@ -22,7 +22,7 @@
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"tsc": "./node_modules/typescript/bin/tsc -p tsconfig.build.json", "tsc": "./node_modules/typescript/bin/tsc -p tsconfig.build.json",
"build": "npm run tsc", "build": "npm run tsc && cp ./src/tasks/price-feeds/mtgox-weekly.json ./dist/tasks/",
"start": "node --max-old-space-size=2048 dist/index.js", "start": "node --max-old-space-size=2048 dist/index.js",
"start-production": "node --max-old-space-size=4096 dist/index.js", "start-production": "node --max-old-space-size=4096 dist/index.js",
"test": "./node_modules/.bin/jest --coverage", "test": "./node_modules/.bin/jest --coverage",

View file

@ -1,4 +1,5 @@
import * as fs from 'fs'; import * as fs from 'fs';
import path from "path";
import { Common } from '../api/common'; import { Common } from '../api/common';
import config from '../config'; import config from '../config';
import logger from '../logger'; import logger from '../logger';
@ -159,7 +160,7 @@ class PriceUpdater {
const existingPriceTimes = await PricesRepository.$getPricesTimes(); const existingPriceTimes = await PricesRepository.$getPricesTimes();
// Insert MtGox weekly prices // Insert MtGox weekly prices
const pricesJson: any[] = JSON.parse(fs.readFileSync('./src/tasks/price-feeds/mtgox-weekly.json').toString()); const pricesJson: any[] = JSON.parse(fs.readFileSync(path.join(__dirname, 'mtgox-weekly.json')).toString());
const prices = this.getEmptyPricesObj(); const prices = this.getEmptyPricesObj();
let insertedCount: number = 0; let insertedCount: number = 0;
for (const price of pricesJson) { for (const price of pricesJson) {