Skip to content

Commit

Permalink
feat: allow config request protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Apr 23, 2019
1 parent 79fb163 commit 7f0c141
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/index.js
Expand Up @@ -29,6 +29,8 @@ var config = {
registryPort: 7001,
webPort: 7002,
bindingHost: '127.0.0.1', // only binding on 127.0.0.1 for local access
// default is ctx.protocol
protocol: '',

// debug mode
// if in debug mode, some middleware like limit wont load
Expand Down
3 changes: 2 additions & 1 deletion lib/common.js
Expand Up @@ -24,8 +24,9 @@ exports.getCDNKey = function (name, filename) {
exports.setDownloadURL = function (pkg, ctx, host) {
if (pkg.dist) {
host = host || config.registryHost || ctx.host;
var protocol = config.protocol || ctx.protocol;
pkg.dist.tarball = util.format('%s://%s/%s/download/%s-%s.tgz',
ctx.protocol,
protocol,
host, pkg.name, pkg.name, pkg.version);
if (ctx.querystring) {
var backupUrl = pkg.dist.tarball;
Expand Down

0 comments on commit 7f0c141

Please sign in to comment.