UNPKG

zeroant-common

Version:
41 lines (36 loc) 774 B
import { AddonConfig } from 'zeroant-factory/addon.config' export class PubSocketConfig extends AddonConfig { get pubUrl() { try { return this.config.get<string>('PUB_SOCKET_URL').split(',') } catch (error) { if (!this.usePub) { return [] } throw error } } get pubKey() { try { return this.config.get<string>('PUB_SOCKET_KEY').split(',') } catch (error) { if (!this.usePub) { return [] } throw error } } get usePub() { return this.config.get<string>('USE_PUB_SOCKET', 'true').toLowerCase() === 'true' } get options() { return this._options() } _options() { return { url: this.pubUrl, key: this.pubKey, usePub: this.usePub } } }