fix(core.gbapp): Trying to fix Config.xlsx access from customer.
This commit is contained in:
parent
d38c629940
commit
c2a51ff832
1 changed files with 16 additions and 10 deletions
|
@ -367,22 +367,27 @@ export class GBDeployer implements IGBDeployer {
|
||||||
* Loads all para from tabular file Config.xlsx.
|
* Loads all para from tabular file Config.xlsx.
|
||||||
*/
|
*/
|
||||||
public async loadParamsFromTabular(min: GBMinInstance): Promise<any> {
|
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.
|
// Connects to MSFT storage.
|
||||||
|
|
||||||
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
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({
|
const client = MicrosoftGraph.Client.init({
|
||||||
authProvider: done => {
|
authProvider: done => {
|
||||||
done(null, token);
|
done(null, token);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Retrives all files in .bot folder.
|
// Retrives all files in .bot folder.
|
||||||
|
|
||||||
const botId = min.instance.botId;
|
const botId = min.instance.botId;
|
||||||
const path = `/${botId}.gbai/${botId}.gbot`;
|
const path = `/${botId}.gbai/${botId}.gbot`;
|
||||||
|
GBLog.info(`Loading .gbot from ${path}.`);
|
||||||
|
|
||||||
const res = await client
|
const res = await client
|
||||||
.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
|
.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
|
||||||
.get();
|
.get();
|
||||||
|
@ -491,24 +496,25 @@ export class GBDeployer implements IGBDeployer {
|
||||||
if (handled) {
|
if (handled) {
|
||||||
return pck;
|
return pck;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploy platform packages here accordingly to their extension.
|
// Deploy platform packages here accordingly to their extension.
|
||||||
|
|
||||||
switch (packageType) {
|
switch (packageType) {
|
||||||
case '.gbot':
|
case '.gbot':
|
||||||
|
|
||||||
// Extracts configuration information from .gbot files.
|
// Extracts configuration information from .gbot files.
|
||||||
|
|
||||||
if (process.env.ENABLE_PARAMS_ONLINE === 'false') {
|
if (process.env.ENABLE_PARAMS_ONLINE === 'false') {
|
||||||
if (Fs.existsSync(localPath)) {
|
if (Fs.existsSync(localPath)) {
|
||||||
|
GBLog.info(`Loading .gbot from ${localPath}.`);
|
||||||
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
|
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
min.instance.params = await this.loadParamsFromTabular(min);
|
min.instance.params = await this.loadParamsFromTabular(min);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates instance object.
|
// Updates instance object.
|
||||||
|
|
||||||
await this.core.saveInstance(min.instance);
|
await this.core.saveInstance(min.instance);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue