fix(core.gbapp): Trying to fix Config.xlsx access from customer.

This commit is contained in:
Rodrigo Rodriguez 2021-01-08 12:54:51 -03:00
parent d38c629940
commit c2a51ff832

View file

@ -367,22 +367,27 @@ export class GBDeployer implements IGBDeployer {
* Loads all para from tabular file Config.xlsx.
*/
public async loadParamsFromTabular(min: GBMinInstance): Promise<any> {
const siteId = process.env.STORAGE_SITE_ID;
const libraryId = process.env.STORAGE_LIBRARY;
GBLog.info(`Connecting to Config.xslx (siteId: ${siteId}, libraryId: ${libraryId})...`);
// Connects to MSFT storage.
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
const siteId = process.env.STORAGE_SITE_ID;
const libraryId = process.env.STORAGE_LIBRARY;
const client = MicrosoftGraph.Client.init({
authProvider: done => {
done(null, token);
}
});
// Retrives all files in .bot folder.
const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbot`;
GBLog.info(`Loading .gbot from ${path}.`);
const res = await client
.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
.get();
@ -501,6 +506,7 @@ export class GBDeployer implements IGBDeployer {
if (process.env.ENABLE_PARAMS_ONLINE === 'false') {
if (Fs.existsSync(localPath)) {
GBLog.info(`Loading .gbot from ${localPath}.`);
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
}
} else {