UNPKG

node-sp-auth-config-nocolors

Version:

Config options builder for node-sp-auth (SharePoint Authentication in Node.js)

34 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.read = void 0; var path = require("path"); var index_1 = require("../index"); var read = 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: false, forcePrompts: false, headlessMode: true, masterKey: options.masterkey }); return authConfig.getContext() .then(function (context) { var contextString = options.format ? JSON.stringify(context, null, 2) : JSON.stringify(context); console.log(contextString); }) .catch(function (error) { console.log('Error:', error); }); }; exports.read = read; //# sourceMappingURL=read.js.map