mirror of https://github.com/winsw/winsw
Update yaml extension support
Improve error messages improve boolean parser remove unncessary logspull/638/head
parent
362ea03104
commit
9f7047012a
|
@ -280,7 +280,6 @@ namespace WinSW
|
||||||
Log.Info("Starting " + this.descriptor.Executable + ' ' + startArguments);
|
Log.Info("Starting " + this.descriptor.Executable + ' ' + startArguments);
|
||||||
|
|
||||||
// Load and start extensions
|
// Load and start extensions
|
||||||
Console.WriteLine("Loading extensinos");
|
|
||||||
this.ExtensionManager.LoadExtensions();
|
this.ExtensionManager.LoadExtensions();
|
||||||
this.ExtensionManager.FireOnWrapperStarted();
|
this.ExtensionManager.FireOnWrapperStarted();
|
||||||
|
|
||||||
|
|
|
@ -648,17 +648,28 @@ namespace WinSW.Configuration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
int extensionNumber = 1;
|
||||||
|
|
||||||
if (this.YamlExtensionsConfiguration is null)
|
if (this.YamlExtensionsConfiguration is null)
|
||||||
{
|
{
|
||||||
return new List<string>(0);
|
return new List<string>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = new List<string>();
|
var result = new List<string>(this.YamlExtensionsConfiguration.Count);
|
||||||
|
|
||||||
foreach (var item in this.YamlExtensionsConfiguration)
|
foreach (var item in this.YamlExtensionsConfiguration)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
result.Add(item.GetId());
|
result.Add(item.GetId());
|
||||||
}
|
}
|
||||||
|
catch (InvalidDataException)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Id is null in Extension " + extensionNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace WinSW.Configuration
|
||||||
{
|
{
|
||||||
if (this.ExtensionId is null)
|
if (this.ExtensionId is null)
|
||||||
{
|
{
|
||||||
throw new InvalidDataException("Extension Id can't be empty");
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ExtensionId;
|
return this.ExtensionId;
|
||||||
|
@ -32,7 +32,7 @@ namespace WinSW.Configuration
|
||||||
{
|
{
|
||||||
if (this.ExtensionClassName is null)
|
if (this.ExtensionClassName is null)
|
||||||
{
|
{
|
||||||
throw new InvalidDataException("Extension ClassName can't be empty");
|
throw new InvalidDataException($@"Extension ClassName is empty in extension {this.GetId()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ExtensionClassName;
|
return this.ExtensionClassName;
|
||||||
|
@ -42,7 +42,7 @@ namespace WinSW.Configuration
|
||||||
{
|
{
|
||||||
if (this.Settings is null)
|
if (this.Settings is null)
|
||||||
{
|
{
|
||||||
throw new InvalidDataException("Extension settings not found");
|
throw new InvalidDataException(@$"Extension settings is empty in extension {this.GetId()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.Settings;
|
return this.Settings;
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace WinSW.Extensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configure the extension from Yaml configuration
|
/// Configure the extension from Yaml configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="descriptor">Yaml Service Descptor</param>
|
/// <param name="descriptor">YamlConfiguration</param>
|
||||||
/// <param name="config">Configuration Node</param>
|
/// <param name="config">Configuration Node</param>
|
||||||
void Configure(IWinSWConfiguration descriptor, YamlExtensionConfiguration config);
|
void Configure(IWinSWConfiguration descriptor, YamlExtensionConfiguration config);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace WinSW.Util
|
||||||
{
|
{
|
||||||
value = value.ToLower();
|
value = value.ToLower();
|
||||||
|
|
||||||
if (value.Equals("true") || value.Equals("yes") || value.Equals("on"))
|
if (value.Equals("true") || value.Equals("yes") || value.Equals("on") || value.Equals("y") || value.Equals("1"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue