Feat hide LocalDev coordinator conditionally

This commit is contained in:
Reckless_Satoshi 2023-12-30 12:27:27 +00:00
parent 138d5cabf9
commit e4b5843a42
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -8,6 +8,7 @@ import {
defaultExchange,
} from '.';
import defaultFederation from '../../static/federation.json';
import { getHost } from '../utils';
import { updateExchangeInfo } from './Exchange.model';
type FederationHooks = 'onCoordinatorUpdate' | 'onFederationReady';
@ -16,8 +17,13 @@ export class Federation {
constructor() {
this.coordinators = Object.entries(defaultFederation).reduce(
(acc: Record<string, Coordinator>, [key, value]: [string, any]) => {
if (getHost() !== '127.0.0.1:8000' && key == 'local') {
// Do not add `Local Dev` unless it is running on localhost
return acc;
} else {
acc[key] = new Coordinator(value);
return acc;
}
},
{},
);