Choose a random hub

This commit is contained in:
Daniel Krol 2022-05-10 17:33:40 -04:00
parent 5acc79d212
commit e7c61254a5
2 changed files with 18 additions and 3 deletions

View file

@ -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<any> {
return this.httpClient.post<any>(`${this.hubEndpoint}/${path}`, body);

View file

@ -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',
]
};
/*