@herbertgao/surgio
Version:
Generating rules for Surge, Clash, Quantumult like a PRO
41 lines • 2.62 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRenderedArtifactCacheMaxage = exports.getIsGFWFree = exports.getProviderCacheMaxage = exports.getRemoteSnippetCacheMaxage = exports.getNetworkClashUA = exports.getNetworkRetry = exports.getNetworkConcurrency = exports.getNetworkResolveTimeout = exports.getNetworkTimeout = void 0;
const ms_1 = __importDefault(require("ms"));
const constant_1 = require("../constant");
const getNetworkTimeout = () => process.env[constant_1.ENV_NETWORK_TIMEOUT_KEY]
? Number(process.env[constant_1.ENV_NETWORK_TIMEOUT_KEY])
: (0, ms_1.default)('5s');
exports.getNetworkTimeout = getNetworkTimeout;
const getNetworkResolveTimeout = () => process.env[constant_1.ENV_NETWORK_RESOLVE_TIMEOUT]
? Number(process.env[constant_1.ENV_NETWORK_RESOLVE_TIMEOUT])
: (0, ms_1.default)('10s');
exports.getNetworkResolveTimeout = getNetworkResolveTimeout;
const getNetworkConcurrency = () => process.env[constant_1.ENV_SURGIO_NETWORK_CONCURRENCY]
? Number(process.env[constant_1.ENV_SURGIO_NETWORK_CONCURRENCY])
: 5;
exports.getNetworkConcurrency = getNetworkConcurrency;
const getNetworkRetry = () => process.env[constant_1.ENV_SURGIO_NETWORK_RETRY]
? Number(process.env[constant_1.ENV_SURGIO_NETWORK_RETRY])
: 0;
exports.getNetworkRetry = getNetworkRetry;
const getNetworkClashUA = () => process.env[constant_1.ENV_SURGIO_NETWORK_CLASH_UA] ?? 'clash';
exports.getNetworkClashUA = getNetworkClashUA;
const getRemoteSnippetCacheMaxage = () => process.env[constant_1.ENV_SURGIO_REMOTE_SNIPPET_CACHE_MAXAGE]
? Number(process.env[constant_1.ENV_SURGIO_REMOTE_SNIPPET_CACHE_MAXAGE])
: (0, ms_1.default)('12h');
exports.getRemoteSnippetCacheMaxage = getRemoteSnippetCacheMaxage;
const getProviderCacheMaxage = () => process.env[constant_1.ENV_SURGIO_PROVIDER_CACHE_MAXAGE]
? Number(process.env[constant_1.ENV_SURGIO_PROVIDER_CACHE_MAXAGE])
: (0, ms_1.default)('10m');
exports.getProviderCacheMaxage = getProviderCacheMaxage;
const getIsGFWFree = () => typeof process.env[constant_1.ENV_SURGIO_GFW_FREE] !== 'undefined';
exports.getIsGFWFree = getIsGFWFree;
const getRenderedArtifactCacheMaxage = () => process.env[constant_1.SURGIO_RENDERED_ARTIFACT_CACHE_MAXAGE]
? Number(process.env[constant_1.SURGIO_RENDERED_ARTIFACT_CACHE_MAXAGE])
: (0, ms_1.default)('7d');
exports.getRenderedArtifactCacheMaxage = getRenderedArtifactCacheMaxage;
//# sourceMappingURL=env-flag.js.map