Skip to content

Commit

Permalink
fix: Make room-assistant read default config even when run from somew…
Browse files Browse the repository at this point in the history
…here else
  • Loading branch information
mKeRix committed Jan 25, 2020
1 parent 7672882 commit 5ef1321
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
19 changes: 0 additions & 19 deletions config/default.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/config/config.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import c from 'config';
import { AppConfig } from '../../config/default';
import { AppConfig } from './definitions/default';

@Injectable()
export class ConfigService {
Expand Down
19 changes: 19 additions & 0 deletions src/config/definitions/default.ts
@@ -0,0 +1,19 @@
import { BluetoothLowEnergyConfig } from '../../integrations/bluetooth-low-energy/bluetooth-low-energy.config';
import { ClusterConfig } from '../../cluster/cluster.config';
import { GlobalConfig } from '../global.config';
import { HomeAssistantConfig } from '../../integrations/home-assistant/home-assistant.config';
import { OmronD6tConfig } from '../../integrations/omron-d6t/omron-d6t.config';
import { GridEyeConfig } from '../../integrations/grid-eye/grid-eye.config';
import { BluetoothClassicConfig } from '../../integrations/bluetooth-classic/bluetooth-classic.config';

export class AppConfig {
global: GlobalConfig = new GlobalConfig();
cluster: ClusterConfig = new ClusterConfig();
bluetoothLowEnergy: BluetoothLowEnergyConfig = new BluetoothLowEnergyConfig();
bluetoothClassic: BluetoothClassicConfig = new BluetoothClassicConfig();
omronD6t: OmronD6tConfig = new OmronD6tConfig();
gridEye: GridEyeConfig = new GridEyeConfig();
homeAssistant: HomeAssistantConfig = new HomeAssistantConfig();
}

module.exports = new AppConfig();
3 changes: 3 additions & 0 deletions src/env.ts
@@ -0,0 +1,3 @@
import { delimiter } from 'path';

process.env.NODE_CONFIG_DIR = `${__dirname}/config/definitions/${delimiter}./config/`;
1 change: 1 addition & 0 deletions src/main.ts
@@ -1,3 +1,4 @@
import './env';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

Expand Down

0 comments on commit 5ef1321

Please sign in to comment.