fix: SettingsStatic class default to yaml file (#158)

* fix: default to yaml file

* fix: intg tests failing

* fix: disable watch settings on tests

* style: lix fint

---------

Co-authored-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
This commit is contained in:
Anton
2023-02-05 00:09:34 -05:00
committed by GitHub
parent a0dcc05b56
commit 7a4667c27f
3 changed files with 8 additions and 3 deletions

View File

@ -37,8 +37,8 @@ export class App implements IRunnable {
} }
public run(): void { public run(): void {
this.watchers = SettingsStatic.watchSettings()
const settings = this.settings() const settings = this.settings()
this.watchers = SettingsStatic.watchSettings()
console.log(` console.log(`
███▄ █ ▒█████ ██████ ▄▄▄█████▓ ██▀███ ▓█████ ▄▄▄ ███▄ ▄███▓ ███▄ █ ▒█████ ██████ ▄▄▄█████▓ ██▀███ ▓█████ ▄▄▄ ███▄ ▄███▓
██ ▀█ █ ▒██▒ ██▒▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀▒████▄ ▓██▒▀█▀ ██▒ ██ ▀█ █ ▒██▒ ██▒▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀▒████▄ ▓██▒▀█▀ ██▒

View File

@ -45,8 +45,12 @@ export class SettingsStatic {
const filteredFile = files.find(fn => fn.startsWith('settings')) const filteredFile = files.find(fn => fn.startsWith('settings'))
if (filteredFile) { if (filteredFile) {
const extension = extname(filteredFile).substring(1) const extension = extname(filteredFile).substring(1)
return SettingsFileTypes[extension] if (SettingsFileTypes[extension]) {
return SettingsFileTypes[extension]
}
} }
return SettingsFileTypes.yaml
} }
public static loadSettings(path: string, fileType: SettingsFileTypes) { public static loadSettings(path: string, fileType: SettingsFileTypes) {

View File

@ -11,6 +11,7 @@ import {
import { assocPath, pipe } from 'ramda' import { assocPath, pipe } from 'ramda'
import { fromEvent, map, Observable, ReplaySubject, Subject, takeUntil } from 'rxjs' import { fromEvent, map, Observable, ReplaySubject, Subject, takeUntil } from 'rxjs'
import WebSocket, { MessageEvent } from 'ws' import WebSocket, { MessageEvent } from 'ws'
import Sinon from 'sinon'
import { connect, createIdentity, createSubscription, sendEvent } from './helpers' import { connect, createIdentity, createSubscription, sendEvent } from './helpers'
import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client' import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client'
@ -38,7 +39,7 @@ BeforeAll({ timeout: 1000 }, async function () {
dbClient = getMasterDbClient() dbClient = getMasterDbClient()
rrDbClient = getReadReplicaDbClient() rrDbClient = getReadReplicaDbClient()
await dbClient.raw('SELECT 1=1') await dbClient.raw('SELECT 1=1')
Sinon.stub(SettingsStatic, 'watchSettings')
const settings = SettingsStatic.createSettings() const settings = SettingsStatic.createSettings()
SettingsStatic._settings = pipe( SettingsStatic._settings = pipe(