Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add channelService to endpoint service of bot configuration file #633

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libraries/botframework-config/src/models/endpointService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export class EndpointService extends ConnectedService implements IEndpointServic
*/
public endpoint: string;

/**
* The channel service (Azure or US Government Azure) for the bot.
* A value of 'https://botframework.azure.us' means the bot will be talking to a US Government Azure data center.
* An undefined or null value means the bot will be talking to public Azure
*/
public channelService: string;

/**
* Creates a new EndpointService instance.
* @param source JSON based service definition.
Expand Down
17 changes: 17 additions & 0 deletions libraries/botframework-config/tests/govTest.bot
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "govTest",
"description": "gov test description",
"version": "2.0",
"secretKey": "",
"services": [
{
"type": "endpoint",
"name": "testEndpoint",
"id": "5",
"appId": "00000003-0000-0000-0000-000000000000",
"appPassword": "testpassword",
"endpoint": "https://test.azurewebsites.net/api/messages",
"channelService": "https://botframework.azure.us"
}
]
}
27 changes: 27 additions & 0 deletions libraries/botframework-config/tests/loadAndSave.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let path = require('path');

// do not save over testbot
const testBotPath = require.resolve("./test.bot");
const govTestBotPath = require.resolve("./govTest.bot");
const legacyBotPath = require.resolve("./legacy.bot");
const saveBotPath = testBotPath.replace("test.bot", "save.bot");

Expand Down Expand Up @@ -118,6 +119,32 @@ describe("LoadAndSaveTests", () => {
await config2.saveAs(saveBotPath, secret);
});

it("LoadAndVerifyChannelServiceSync", async () => {
var config = bf.BotConfiguration.loadSync(testBotPath);
for (let i = 0; i < config.services.length; i++) {
switch (config.services[i].type) {
case bf.ServiceTypes.Endpoint:
{
var endpoint = config.services[i];
assert.equal(undefined, endpoint.channelService);
}
break;
}
}

var govConfig = bf.BotConfiguration.loadSync(govTestBotPath);
for (let i = 0; i < govConfig.services.length; i++) {
switch (govConfig.services[i].type) {
case bf.ServiceTypes.Endpoint:
{
var endpoint = govConfig.services[i];
assert.equal('https://botframework.azure.us', endpoint.channelService);
}
break;
}
}
});

it("LoadAndSaveEncrypted", async () => {
let secret = bf.BotConfiguration.generateKey();
var config = await bf.BotConfiguration.load(testBotPath);
Expand Down