diff --git a/lib/cli.js b/lib/cli.js index 259e702..14f768e 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -181,13 +181,13 @@ CLI.prototype.init = function (opts, args, callback) { var dir = path.dirname(userConfigPath); var cacheDir = path.join(dir, 'cache'); - [dir, cacheDir].forEach(function (d) { + if (!fs.existsSync(cacheDir)) { try { - fs.mkdirSync(d); + fs.mkdirSync(cacheDir); } catch (e) { - log.info({err: e}, 'failed to make dir %s', d); + log.info({err: e}, 'failed to make dir %s', cacheDir); } - }); + } // XXX support keyId being a priv or pub key path, a la imgapi-cli // XXX Add TRITON_* envvars.