This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
Update settingsManager to support multiple environments #1010
Merged
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
df217f6
Backend settings calls for settings manager
8121e2a
Update bot connector
e610b4d
Merge branch 'master' into absh/settingsApis
Jeffders 3cc1ab2
Merge branch 'master' into absh/settingsApis
cwhitten 358ce4a
Merge branch 'master' into absh/settingsApis
068ff5d
Refactoring service to add some IoC
66260b7
remove absh reference from botProject
f80eeeb
Merge branch 'absh/settingsApis' of https://github.com/microsoft/BotF…
4bea5f4
Merge branch 'master' into absh/settingsApis
0eba3a9
Merge branch 'master' into absh/settingsApis
cwhitten 67423d5
PR feedback, mainly to fix the module load issue
00fee4b
Merge branch 'absh/settingsApis' of https://github.com/microsoft/BotF…
6c83c63
Merge branch 'master' into absh/settingsApis
fd46b5c
lint
8cfd093
Merge branch 'master' into absh/settingsApis
cwhitten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Composer/packages/server/__tests__/models/settings/fileSettingManager.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { FileSettingManager } from '../../../src/models/settings/fileSettingManager'; | ||
| import { Path } from '../../../src/utility/path'; | ||
|
|
||
| const dir = './mocks'; | ||
| const defaultDir = Path.join(__dirname, dir); | ||
|
|
||
| describe('get', () => { | ||
| it('return values', async () => { | ||
| const sm = new FileSettingManager(defaultDir); | ||
| const result = await sm.get('', false); | ||
| expect(result.label).toBe('default'); | ||
| }); | ||
|
|
||
| it('return obfuscated alues', async () => { | ||
| const sm = new FileSettingManager(defaultDir); | ||
| const result = await sm.get('', true); | ||
| expect(result.label).toBe('*****'); | ||
| expect(result.mock1).toBe('*****'); | ||
| expect(result.mock2).toBe('*****'); | ||
| expect(result.mock3.mock3).toBe('*****'); | ||
| expect(result.mock3.mock4).toBe('*****'); | ||
| expect(result.mock3.mock5[0]).toBe('*****'); | ||
| expect(result.mock3.mock5[1]).toBe('*****'); | ||
| }); | ||
|
|
||
| it('return slot values', async () => { | ||
| const sm = new FileSettingManager(defaultDir); | ||
| const result = await sm.get('integration', false); | ||
| expect(result.label).toBe('integration'); | ||
| const result2 = await sm.get('production', false); | ||
| expect(result2.label).toBe('production'); | ||
| const result3 = await sm.get('bonus', false); | ||
| expect(result3.label).toBe('bonus'); | ||
| }); | ||
| }); |
19 changes: 19 additions & 0 deletions
19
Composer/packages/server/__tests__/models/settings/hostedSettingManager.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { HostedSettingManager } from '../../../src/models/settings/hostedSettingManager'; | ||
| import { Path } from '../../../src/utility/path'; | ||
|
|
||
| const dir = './mocks'; | ||
| const defaultDir = Path.join(__dirname, dir); | ||
|
|
||
| describe('get', () => { | ||
| it('throws with invalid slot name', async () => { | ||
| const sm = new HostedSettingManager(defaultDir); | ||
| let threw = false; | ||
| try { | ||
| await sm.get('bad', true); | ||
| } catch (x) { | ||
| threw = true; | ||
| } | ||
|
|
||
| expect(threw).toBeTruthy(); | ||
| }); | ||
| }); |
13 changes: 13 additions & 0 deletions
13
Composer/packages/server/__tests__/models/settings/mocks/bonus/settings/appsettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "label": "bonus", | ||
| "mock1": 123, | ||
| "mock2": "abc", | ||
| "mock3": { | ||
| "mock3": 456, | ||
| "mock4": "xyz", | ||
| "mock5": [ | ||
| 789, | ||
| "pnm" | ||
| ] | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...ser/packages/server/__tests__/models/settings/mocks/integration/settings/appsettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "label": "integration", | ||
| "mock1": 123, | ||
| "mock2": "abc", | ||
| "mock3": { | ||
| "mock3": 456, | ||
| "mock4": "xyz", | ||
| "mock5": [ | ||
| 789, | ||
| "pnm" | ||
| ] | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...oser/packages/server/__tests__/models/settings/mocks/production/settings/appsettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "label": "production", | ||
| "mock1": 123, | ||
| "mock2": "abc", | ||
| "mock3": { | ||
| "mock3": 456, | ||
| "mock4": "xyz", | ||
| "mock5": [ | ||
| 789, | ||
| "pnm" | ||
| ] | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
Composer/packages/server/__tests__/models/settings/mocks/settings/appsettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "label": "default", | ||
| "mock1": 123, | ||
| "mock2": "abc", | ||
| "mock3": { | ||
| "mock3": 456, | ||
| "mock4": "xyz", | ||
| "mock5": [ | ||
| 789, | ||
| "pnm" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.