mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
prep for live mocks
This commit is contained in:
committed by
Aiden McClelland
parent
8b84bdefac
commit
53a16775fe
@@ -11,13 +11,24 @@ export function PatchDbModelFactory (
|
||||
http: ApiService,
|
||||
): PatchDbModel {
|
||||
|
||||
const { patchDb: { usePollOverride, poll, websocket, timeoutForMissingRevision }, isConsulate } = config
|
||||
const { mocks, patchDb: { poll, timeoutForMissingRevision }, isConsulate, isLan } = config
|
||||
|
||||
let source: Source<DataModel>
|
||||
if (isConsulate || usePollOverride) {
|
||||
source = new PollSource({ ...poll }, http)
|
||||
|
||||
if (mocks.enabled) {
|
||||
if (mocks.connection === 'poll') {
|
||||
source = new PollSource({ ...poll }, http)
|
||||
} else {
|
||||
source = new WebsocketSource('ws://localhost:8081')
|
||||
}
|
||||
} else {
|
||||
source = new WebsocketSource({ ...websocket })
|
||||
if (isConsulate) {
|
||||
source = new PollSource({ ...poll }, http)
|
||||
} else {
|
||||
const protocol = window.location.protocol === 'http:' ? 'ws' : 'wss'
|
||||
const host = window.location.host
|
||||
source = new WebsocketSource(`${protocol}://${host}/ws/db`)
|
||||
}
|
||||
}
|
||||
|
||||
return new PatchDbModel({ sources: [source, http], bootstrapper, http, timeoutForMissingRevision })
|
||||
|
||||
Reference in New Issue
Block a user