You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dev-sidecar/packages/core/start/mitmproxy.js

25 lines
1.0 KiB

const server = require('@docmirror/mitmproxy')
const jsonApi = require('@docmirror/mitmproxy/src/json')
const path = require('path')
const home = process.env.USER_HOME || process.env.HOME || 'C:/Users/Administrator/'
const log = require('../src/utils/util.log')
let configPath
4 years ago
if (process.argv && process.argv.length > 3) {
configPath = process.argv[2]
} else {
configPath = path.join(home, '.dev-sidecar/running.json')
4 years ago
}
const fs = require('fs')
const configJson = fs.readFileSync(configPath)
log.info('读取 running.json by core 成功:', configPath)
const config = jsonApi.parse(configJson.toString())
3 years ago
// const scriptDir = '../../gui/extra/scripts/'
// config.setting.script.defaultDir = path.join(__dirname, scriptDir)
// const pacFilePath = '../../gui/extra/pac/pac.txt'
// config.plugin.overwall.pac.customPacFilePath = path.join(__dirname, pacFilePath)
config.setting.rootDir = path.join(__dirname, '../../gui/')
log.info(`start mitmproxy config by core: 读取配置文件: ${configPath}`)
server.start(config)