Get registryURL from server config
This commit is contained in:
parent
29697ed201
commit
625e36ec5b
|
@ -4,3 +4,6 @@ exports.origin =
|
|||
process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test"
|
||||
? "https://unpkg.com"
|
||||
: `http://localhost:${exports.port}`;
|
||||
|
||||
exports.registryURL =
|
||||
process.env.NPM_REGISTRY_URL || "https://registry.npmjs.org";
|
||||
|
|
|
@ -5,6 +5,7 @@ const tmpdir = require("os-tmpdir");
|
|||
const gunzip = require("gunzip-maybe");
|
||||
const mkdirp = require("mkdirp");
|
||||
const tar = require("tar-fs");
|
||||
|
||||
const createMutex = require("./createMutex");
|
||||
|
||||
function createTempPath(name, version) {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
require("isomorphic-fetch");
|
||||
|
||||
const config = require("../../config");
|
||||
|
||||
const createCache = require("./createCache");
|
||||
const createMutex = require("./createMutex");
|
||||
|
||||
const registryURL =
|
||||
process.env.NPM_REGISTRY_URL || "https://registry.npmjs.org";
|
||||
|
||||
const packageInfoCache = createCache("packageInfo");
|
||||
|
||||
function fetchPackageInfo(packageName) {
|
||||
|
@ -18,7 +17,7 @@ function fetchPackageInfo(packageName) {
|
|||
encodedPackageName = encodeURIComponent(packageName);
|
||||
}
|
||||
|
||||
const url = `${registryURL}/${encodedPackageName}`;
|
||||
const url = `${config.registryURL}/${encodedPackageName}`;
|
||||
|
||||
return fetch(url, {
|
||||
headers: {
|
||||
|
|
Loading…
Reference in New Issue