@stellar/stellar-sdk
Version:
A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.
48 lines (46 loc) • 1.08 kB
JavaScript
const defaultConfig = {
allowHttp: false,
timeout: 0
};
let config = { ...defaultConfig };
class Config {
/**
* Sets `allowHttp` flag globally. When set to `true`, connections to insecure
* http protocol servers will be allowed. Must be set to `false` in
* production.
* @defaultValue false
*/
static setAllowHttp(value) {
config.allowHttp = value;
}
/**
* Sets `timeout` flag globally. When set to anything besides 0, the request
* will timeout after specified time (ms).
* @defaultValue 0
*/
static setTimeout(value) {
config.timeout = value;
}
/**
* Returns the configured `allowHttp` flag.
* @returns The allowHttp value.
*/
static isAllowHttp() {
return config.allowHttp;
}
/**
* Returns the configured `timeout` flag.
* @returns The timeout value.
*/
static getTimeout() {
return config.timeout;
}
/**
* Sets all global config flags to default values.
*/
static setDefault() {
config = { ...defaultConfig };
}
}
export { Config };
//# sourceMappingURL=config.js.map