From 38e86afc565ae8c9c23614855c4ee2c3ac02f2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8=E9=83=A8=E8=90=BD?= <31075951+laozhoubuluo@users.noreply.github.com> Date: Wed, 23 Nov 2022 23:36:59 +0800 Subject: [PATCH] Add Custom PIP URL --- backend/internal/certificate.js | 3 ++- backend/setup.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js index d6b72f57..7a0be841 100644 --- a/backend/internal/certificate.js +++ b/backend/internal/certificate.js @@ -17,6 +17,7 @@ const certbotCommand = 'certbot'; const archiver = require('archiver'); const path = require('path'); const { isArray } = require('lodash'); +const PIP_URL = process.env.PIP_URL !== '' ? process.env.PIP_URL : 'https://www.piwheels.org/simple'; function omissions() { return ['is_deleted']; @@ -878,7 +879,7 @@ const internalCertificate = { // Special case for cloudflare if (dns_plugin.package_name === 'certbot-dns-cloudflare') { - prepareCmd = 'pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary'; + prepareCmd = 'pip install certbot-dns-cloudflare --prefer-binary --index-url ' + PIP_URL; } // Whether the plugin has a ---credentials argument diff --git a/backend/setup.js b/backend/setup.js index 239c8c0b..7bfbf78c 100644 --- a/backend/setup.js +++ b/backend/setup.js @@ -10,6 +10,7 @@ const authModel = require('./models/auth'); const settingModel = require('./models/setting'); const dns_plugins = require('./global/certbot-dns-plugins'); const debug_mode = process.env.NODE_ENV !== 'production' || !!process.env.DEBUG; +const PIP_URL = process.env.PIP_URL !== '' ? process.env.PIP_URL : 'https://www.piwheels.org/simple'; /** * Creates a new JWT RSA Keypair if not alread set on the config @@ -199,7 +200,7 @@ const setupCertbotPlugins = () => { } if (install_cloudflare_plugin) { - promises.push(utils.exec('pip install certbot-dns-cloudflare --index-url https://www.piwheels.org/simple --prefer-binary')); + promises.push(utils.exec('pip install certbot-dns-cloudflare --prefer-binary --index-url ' + PIP_URL)); } if (promises.length) {