Skip to content

Commit

Permalink
fix: logs, config, db now in /cadt
Browse files Browse the repository at this point in the history
  • Loading branch information
brodoin committed May 4, 2023
1 parent cd258d1 commit 2df57eb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "npm run resetTestDb && npx cross-env NODE_ENV=test USE_SIMULATOR=true mocha tests/**/*.spec.js --reporter spec --exit --timeout 300000",
"release": "npx standard-version",
"postinstall": "npm run requirements-check",
"cleandb": "rm -f ~/.chia/climate-warehouse/data.sqlite3",
"cleandb": "rm -f ~/.chia/cadt/data.sqlite3",
"resetTestDb": "rm -f ./test.sqlite3 && rm -f ./testMirror.sqlite3",
"resetMirrorDb": "npx sequelize-cli db:drop --env mirror",
"prepare": "husky install",
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getConfig } from '../utils/config-loader';
import { getDataModelVersion } from '../utils/helpers';
import {getChiaRoot} from "../utils/chia-root.js"
import { getChiaRoot } from '../utils/chia-root.js';

const chiaRoot = getChiaRoot();

const persistanceFolder = `${chiaRoot}/climate-warehouse/${getDataModelVersion()}`;
const persistanceFolder = `${chiaRoot}/cadt/${getDataModelVersion()}`;

export default {
local: {
Expand Down
2 changes: 1 addition & 1 deletion src/config/logger.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getDataModelVersion = () => {
return `v${majorVersion}`;
};

const logDir = `${chiaRoot}/climate-warehouse/${getDataModelVersion()}/logs`;
const logDir = `${chiaRoot}/cadt/${getDataModelVersion()}/logs`;

if (!fs.existsSync(logDir)) {
fs.mkdirSync(logDir, { recursive: true });
Expand Down
5 changes: 2 additions & 3 deletions src/utils/config-loader.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import _ from 'lodash';
import yaml from 'js-yaml';
import fs from 'fs';
import os from 'os';
import path from 'path';

import { logger } from '../config/logger.cjs';

import { getDataModelVersion } from './helpers';
import defaultConfig from './defaultConfig.json';
import {getChiaRoot} from "./chia-root.js"
import { getChiaRoot } from './chia-root.js';

export const getConfig = _.memoize(() => {
const chiaRoot = getChiaRoot();
const dataModelVersion = getDataModelVersion();
const persistanceFolder = `${chiaRoot}/climate-warehouse/${dataModelVersion}`;
const persistanceFolder = `${chiaRoot}/cadt/${dataModelVersion}`;
const configFile = path.resolve(`${persistanceFolder}/config.yaml`);

try {
Expand Down

0 comments on commit 2df57eb

Please sign in to comment.