- 修复Dockerfile构建问题,暂时禁用ideal-image插件 - 更新所有配置文件中的registry端口为5003 - 添加.dockerignore文件优化构建性能 - 创建docker-compose.yml文件支持本地部署 - 添加部署脚本scripts/deploy-docker.sh - 更新Gitea Actions工作流,添加Docker部署步骤 - 创建DOCKER_DEPLOYMENT.md部署文档 - 支持通过3001端口提供lingjingwanxiang web portal服务
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
// Copyright 2013 Lovell Fuller and others.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
const url = require('url');
|
|
const tunnelAgent = require('tunnel-agent');
|
|
|
|
const is = require('./is');
|
|
|
|
const proxies = [
|
|
'HTTPS_PROXY',
|
|
'https_proxy',
|
|
'HTTP_PROXY',
|
|
'http_proxy',
|
|
'npm_config_https_proxy',
|
|
'npm_config_proxy'
|
|
];
|
|
|
|
function env (key) {
|
|
return process.env[key];
|
|
}
|
|
|
|
module.exports = function (log) {
|
|
try {
|
|
const proxy = new url.URL(proxies.map(env).find(is.string));
|
|
const tunnel = proxy.protocol === 'https:'
|
|
? tunnelAgent.httpsOverHttps
|
|
: tunnelAgent.httpsOverHttp;
|
|
const proxyAuth = proxy.username && proxy.password
|
|
? `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`
|
|
: null;
|
|
log(`Via proxy ${proxy.protocol}//${proxy.hostname}:${proxy.port} ${proxyAuth ? 'with' : 'no'} credentials`);
|
|
return tunnel({
|
|
proxy: {
|
|
port: Number(proxy.port),
|
|
host: proxy.hostname,
|
|
proxyAuth
|
|
}
|
|
});
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
};
|