Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Don't show 'restricted' config val
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Dec 20, 2010
1 parent 9deb052 commit d5fb509
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var ini = require("./utils/ini")
, fs = require("./utils/graceful-fs")
, dc
, output = require("./utils/output")
, parseArgs = require("./utils/parse-args")

// npm config set key value
// npm config get key
Expand Down Expand Up @@ -113,7 +114,10 @@ function set (key, val, cb) {
function get (key, cb) {
var outfd = npm.config.get("outfd")
if (!key) return list(cb)
if (key.charAt(0) === "_") return cb(new Error("---sekretz---"))
if (key.charAt(0) === "_"
|| parseArgs.types[key] !== parseArgs.types[key]) {
return cb(new Error("---sekretz---"))
}
output.write(outfd, npm.config.get(key), cb)
}

Expand All @@ -122,6 +126,9 @@ function list (cb) {
, outfd = npm.config.get("outfd")
ini.keys.sort(function (a,b) { return a > b ? 1 : -1 })
.forEach(function (i) {
if (parseArgs.types[i] !== parseArgs.types[i]) {
return
}
var val = (i.charAt(0) === "_")
? "---sekretz---"
: JSON.stringify(ini.get(i))
Expand Down

0 comments on commit d5fb509

Please sign in to comment.