Skip to content

Commit

Permalink
fix: SettingsStatic class default to yaml file (#158)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
antonleviathan and cameri committed Feb 5, 2023
1 parent a0dcc05 commit 7a4667c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class App implements IRunnable {
}

public run(): void {
this.watchers = SettingsStatic.watchSettings()
const settings = this.settings()
this.watchers = SettingsStatic.watchSettings()
console.log(`
███▄ █ ▒█████ ██████ ▄▄▄█████▓ ██▀███ ▓█████ ▄▄▄ ███▄ ▄███▓
██ ▀█ █ ▒██▒ ██▒▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀▒████▄ ▓██▒▀█▀ ██▒
Expand Down
6 changes: 5 additions & 1 deletion src/utils/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export class SettingsStatic {
const filteredFile = files.find(fn => fn.startsWith('settings'))
if (filteredFile) {
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) {
Expand Down
3 changes: 2 additions & 1 deletion test/integration/features/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { assocPath, pipe } from 'ramda'
import { fromEvent, map, Observable, ReplaySubject, Subject, takeUntil } from 'rxjs'
import WebSocket, { MessageEvent } from 'ws'
import Sinon from 'sinon'

import { connect, createIdentity, createSubscription, sendEvent } from './helpers'
import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client'
Expand Down Expand Up @@ -38,7 +39,7 @@ BeforeAll({ timeout: 1000 }, async function () {
dbClient = getMasterDbClient()
rrDbClient = getReadReplicaDbClient()
await dbClient.raw('SELECT 1=1')

Sinon.stub(SettingsStatic, 'watchSettings')
const settings = SettingsStatic.createSettings()

SettingsStatic._settings = pipe(
Expand Down

0 comments on commit 7a4667c

Please sign in to comment.