From e7c61254a57ad31cd6fe41ea5bc8d7e747eea5c4 Mon Sep 17 00:00:00 2001 From: Daniel Krol Date: Tue, 10 May 2022 17:33:40 -0400 Subject: [PATCH] Choose a random hub --- src/app/hub.service.ts | 9 +++++++-- src/environments/environment.ts | 12 +++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/app/hub.service.ts b/src/app/hub.service.ts index 0fb2a8e..689badd 100644 --- a/src/app/hub.service.ts +++ b/src/app/hub.service.ts @@ -7,11 +7,16 @@ import {environment} from '../environments/environment'; providedIn: 'root' }) export class HubService { - hubEndpoint = `https://${environment.hubHostname}/api/v0`; + hubEndpoint = ''; constructor( private httpClient: HttpClient, - ) { } + ) { + const hubHostname = environment.hubHostnames[ + Math.floor(Math.random() * environment.hubHostnames.length) + ]; + this.hubEndpoint = `https://${hubHostname}`; + } post(path: string, body: any): Observable { return this.httpClient.post(`${this.hubEndpoint}/${path}`, body); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4a88b89..1c6bb9f 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -7,7 +7,17 @@ export const environment = { hostname: 'localhost:4201', nodeHostname: 'node.deso.org', // TODO deleteme walletSyncHostname: 'localhost:8091', - hubHostname: '', // TODO put me in a config file, or make this whole file a config file + hubHostnames: [ + 'spv11.lbry.com:50001', + 'spv12.lbry.com:50001', + 'spv13.lbry.com:50001', + 'spv14.lbry.com:50001', + 'spv15.lbry.com:50001', + 'spv16.lbry.com:50001', + 'spv17.lbry.com:50001', + 'spv18.lbry.com:50001', + 'spv19.lbry.com:50001', + ] }; /*