Use hasProcess for process check (#550)

This commit is contained in:
Jaco
2021-11-30 16:35:03 +01:00
committed by GitHub
parent 266307fbc2
commit e0ad510e97
+2 -2
View File
@@ -6,7 +6,7 @@ import type { Endpoint, EndpointType, Option, SettingsStruct } from './types';
import EventEmitter from 'eventemitter3';
import store from 'store';
import { isUndefined } from '@polkadot/util';
import { hasProcess, isUndefined } from '@polkadot/util';
import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
@@ -53,7 +53,7 @@ export class Settings implements SettingsStruct {
this.#emitter = new EventEmitter();
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (typeof process === 'object' && process.env && process.env.WS_URL) || (ENDPOINT_DEFAULT.value as string);
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (hasProcess && process.env && process.env.WS_URL) || (ENDPOINT_DEFAULT.value as string);
this.#apiType = { param: this.#apiUrl, type: 'json-rpc' as EndpointType };
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);