Skip to content

Commit 516e3a0

Browse files
Renames disabled to enabled in plugin config. Closes #212 (#220)
1 parent 24c6910 commit 516e3a0

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/msgraph-developer-proxy/bin/Debug/net6.0/mgdp.dll",
13+
"program": "${workspaceFolder}/msgraph-developer-proxy/bin/Debug/net7.0/mgdp.dll",
1414
"args": [],
1515
"cwd": "${workspaceFolder}/msgraph-developer-proxy",
1616
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

msgraph-developer-proxy/PluginLoader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public PluginLoaderResult LoadPlugins(IPluginEvents pluginEvents, IProxyContext
3030
string? rootDirectory = Path.GetDirectoryName(AppContext.BaseDirectory);
3131
if (!string.IsNullOrEmpty(rootDirectory)) {
3232
foreach (PluginReference h in config.Plugins) {
33-
if (h.Disabled) continue;
34-
// Load Handler Assembly if not disabled
33+
if (!h.Enabled) continue;
34+
// Load Handler Assembly if enabled
3535
string pluginLocation = Path.GetFullPath(Path.Combine(rootDirectory, h.PluginPath.Replace('\\', Path.DirectorySeparatorChar)));
3636
PluginLoadContext pluginLoadContext = new PluginLoadContext(pluginLocation);
3737
_logger.LogDebug($"Loading from: {pluginLocation}");
@@ -103,7 +103,7 @@ internal class PluginConfig {
103103
}
104104

105105
internal class PluginReference {
106-
public bool Disabled { get; set; }
106+
public bool Enabled { get; set; } = true;
107107
public string? ConfigSection { get; set; }
108108
public string PluginPath { get; set; } = string.Empty;
109109
public string Name { get; set; } = string.Empty;

msgraph-developer-proxy/appsettings.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"plugins": [
33
{
44
"name": "GraphSelectGuidancePlugin",
5-
"disabled": false,
5+
"enabled": true,
66
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
77
"urlsToWatch": [
88
"https://graph.microsoft.com/v1.0/*",
@@ -17,7 +17,7 @@
1717
},
1818
{
1919
"name": "GraphBetaSupportGuidancePlugin",
20-
"disabled": false,
20+
"enabled": true,
2121
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
2222
"urlsToWatch": [
2323
"https://graph.microsoft.com/beta/*",
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"name": "GraphSdkGuidancePlugin",
31-
"disabled": false,
31+
"enabled": true,
3232
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
3333
"urlsToWatch": [
3434
"https://graph.microsoft.com/v1.0/*",
@@ -43,19 +43,19 @@
4343
},
4444
{
4545
"name": "MockResponsePlugin",
46-
"disabled": false,
46+
"enabled": true,
4747
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
4848
"configSection": "mocksPlugin"
4949
},
5050
{
5151
"name": "GraphRandomErrorPlugin",
52-
"disabled": false,
52+
"enabled": true,
5353
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
5454
"configSection": "graphRandomErrorsPlugin"
5555
},
5656
{
5757
"name": "ExecutionSummaryPlugin",
58-
"disabled": false,
58+
"enabled": true,
5959
"pluginPath": "GraphProxyPlugins\\msgraph-developer-proxy-plugins.dll",
6060
"configSection": "executionSummaryPlugin"
6161
}

specs/plugins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The existing `appsettings.json` file will be used to provide configuration. Both
2525
- `name` - required, a string identifier for the plugin class, allows developer to ship multiple plugins in a single assembly. This should correspond to the value returned by the `Name` property defined on the plugin class. Plugin names must be unique per-assembly.
2626
- `configSection` - optional, a string for which there must be a matching object property at the root of the configuration file. If a plugin supplies a `configSection` and no corresponding property exists in the configuration file an error will be thrown during start up of the proxy.
2727
- `urlsToWatch` - optional, an array of strings defining the urls for which this plugin will watch instead of the `urlsToWatch` at the root of the config file, this behavior is defined in the [Multi URL support spec](./multi-url-support.md).
28-
- `disabled` - optional boolean when true the proxy will not attempt to load this plugin.
28+
- `enabled` - optional boolean when `false` the proxy will not attempt to load this plugin. `true` by default.
2929

3030
```json
3131
"plugins": [
@@ -37,7 +37,7 @@ The existing `appsettings.json` file will be used to provide configuration. Both
3737
"https://graph.microsoft.com/v1.0/*",
3838
"https://graph.microsoft.com/beta/*"
3939
],
40-
"disabled": false
40+
"enabled": true
4141
}
4242
],
4343
"randomErrors": {

0 commit comments

Comments
 (0)