node-sp-auth-config-nocolors
Version:
Config options builder for node-sp-auth (SharePoint Authentication in Node.js)
32 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.init = void 0;
var path = require("path");
var index_1 = require("../index");
var init = function (options) {
if (typeof options.path === 'undefined') {
console.log('\'-p, --path\' parameter should be provided', '(relative path to file which will store your credentials)');
process.exit();
}
var extension = path.extname(options.path);
if (extension !== '.json') {
console.log('\'--path\' file extension should to be .json');
process.exit();
}
var authConfig = new index_1.AuthConfig({
configPath: options.path,
encryptPassword: options.encrypt,
saveConfigOnDisk: true,
forcePrompts: true,
masterKey: options.masterkey
});
return authConfig.getContext()
.then(function () {
console.log("\n 'File saved to' ".concat(path.resolve(options.path)));
})
.catch(function (error) {
console.log('Error:', error);
});
};
exports.init = init;
//# sourceMappingURL=init.js.map