Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SettingsStatic class default to yaml file #158

Merged
merged 4 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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