Skip to content
Open
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
1 change: 1 addition & 0 deletions DevProxy/Commands/DevProxyConfigOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public string? ConfigFile
public int? ApiPort => _parseResult?.GetValueOrDefault<int?>(DevProxyCommand.ApiPortOptionName);
public bool Discover => _parseResult?.GetValueOrDefault<bool?>(DevProxyCommand.DiscoverOptionName) ?? false;
public string? IPAddress => _parseResult?.GetValueOrDefault<string?>(DevProxyCommand.IpAddressOptionName);
public bool IsStdioMode => _parseResult?.CommandResult.Command.Name == "stdio";
public LogLevel? LogLevel => _parseResult?.GetValueOrDefault<LogLevel?>(DevProxyCommand.LogLevelOptionName);

public List<string>? UrlsToWatch
Expand Down
20 changes: 12 additions & 8 deletions DevProxy/Plugins/PluginServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public static IServiceCollection AddPlugins(
assembly,
configuration,
services,
logger);
logger,
options.IsStdioMode);
}
catch (Exception ex)
{
Expand All @@ -149,14 +150,9 @@ private static void RegisterPlugin(
Assembly assembly,
IConfiguration configuration,
IServiceCollection services,
ILogger logger)
ILogger logger,
bool isStdioMode)
{
if (urlsToWatch.Count == 0)
{
logger.LogError("Plugin {PluginName} must have at least one URL to watch. Please add a URL to watch in the configuration file or use the --urls-to-watch option.", pluginRef.Name);
return;
}

var pluginType = assembly.GetTypes()
.FirstOrDefault(t => t.Name == pluginRef.Name && typeof(IPlugin).IsAssignableFrom(t));
if (pluginType is null)
Expand All @@ -165,6 +161,14 @@ private static void RegisterPlugin(
return;
}

// In stdio mode, plugins don't need URLs to watch because they
// communicate through STDIO (JSON-RPC) rather than HTTP
if (urlsToWatch.Count == 0 && !isStdioMode)
{
logger.LogError("Plugin {PluginName} must have at least one URL to watch. Please add a URL to watch in the configuration file or use the --urls-to-watch option.", pluginRef.Name);
return;
}

var isConfigurable = IsConfigurablePlugin(pluginType, out var configType);

if (!isConfigurable || configType is null)
Expand Down
Loading