UNPKG

@hippy/debug-server-next

Version:
64 lines (63 loc) 3.02 kB
"use strict"; /* * Tencent is pleased to support the open source community by making * Hippy available. * * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); exports.config = void 0; const tslib_1 = require("tslib"); const path_1 = tslib_1.__importDefault(require("path")); const enum_1 = require("@debug-server-next/@types/enum"); exports.config = { ...getPublicDomain(), wsPath: '/debugger-proxy', cachePath: path_1.default.join(__dirname, 'cache'), hmrStaticPath: path_1.default.join(process.env.HMRStaticPath || __dirname, 'hmr'), logPath: path_1.default.join(__dirname, 'log'), hmrPortPath: path_1.default.join(__dirname, 'cache/hmr-port.txt'), iWDPStartPort: ((_a = global.debugAppArgv) === null || _a === void 0 ? void 0 : _a.iWDPStartPort) || 9200, iWDPEndPort: ((_b = global.debugAppArgv) === null || _b === void 0 ? void 0 : _b.iWDPEndPort) || 9300, redis: { // ⚠️ redis-server < v6, username field must by null url: `redis://:${process.env.REDIS_PWD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}/0`, debugTargetTable: 'tdf:debugtargets', bundleTable: 'tdf:bundles', logTablePrefix: 'tdf:logs:', }, isCluster: process.env.IS_CLUSTER === 'true', cos: { SecretId: process.env.SecretId, SecretKey: process.env.SecretKey, Bucket: process.env.Bucket, Region: process.env.Region, StorageClass: process.env.StorageClass, }, staticFileStorage: process.env.StaticFileStorage || enum_1.StaticFileStorage.Local, aegisId: 'yxqehauSsvzBZxdRmz', showPerformance: false, }; function getPublicDomain() { var _a, _b, _c, _d; const hostFromArgv = !((_a = global.debugAppArgv) === null || _a === void 0 ? void 0 : _a.host) || ((_b = global.debugAppArgv) === null || _b === void 0 ? void 0 : _b.host) === '0.0.0.0' ? 'localhost' : (_c = global.debugAppArgv) === null || _c === void 0 ? void 0 : _c.host; const portFromArgv = ((_d = global.debugAppArgv) === null || _d === void 0 ? void 0 : _d.port) || 38989; const domain = process.env.DOMAIN || `http://${hostFromArgv}:${portFromArgv}`; const wsDomain = domain.replace('https://', 'wss://').replace('http://', 'ws://'); const wsProtocol = domain.startsWith('https://') ? 'wss' : 'ws'; return { domain, wsDomain, wsProtocol }; }