diff --git a/src/Core/WinSWCore/Configuration/DefaultSettings.cs b/src/Core/WinSWCore/Configuration/DefaultSettings.cs index b9d2566..a1443ef 100644 --- a/src/Core/WinSWCore/Configuration/DefaultSettings.cs +++ b/src/Core/WinSWCore/Configuration/DefaultSettings.cs @@ -24,7 +24,7 @@ namespace winsw.Configuration // Installation public bool AllowServiceAcountLogonRight => false; public string? ServiceAccountPassword => null; - public string ServiceAccountUser => "NULL\\NULL"; + public string? ServiceAccountUser => null; public List FailureActions => new List(0); public TimeSpan ResetFailureAfter => TimeSpan.FromDays(1); diff --git a/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs b/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs index 3d9585b..2da55a0 100644 --- a/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs +++ b/src/Core/WinSWCore/Configuration/IWinSWConfiguration.cs @@ -20,7 +20,7 @@ namespace winsw.Configuration // Installation bool AllowServiceAcountLogonRight { get; } string? ServiceAccountPassword { get; } - string ServiceAccountUser { get; } + string? ServiceAccountUser { get; } List FailureActions { get; } TimeSpan ResetFailureAfter { get; } diff --git a/src/Core/WinSWCore/ServiceDescriptor.cs b/src/Core/WinSWCore/ServiceDescriptor.cs index 97a68fc..f4b8188 100755 --- a/src/Core/WinSWCore/ServiceDescriptor.cs +++ b/src/Core/WinSWCore/ServiceDescriptor.cs @@ -634,19 +634,17 @@ namespace winsw protected string? AllowServiceLogon => GetServiceAccountPart("allowservicelogon"); - // ReSharper disable once InconsistentNaming - protected string? serviceAccountDomain => GetServiceAccountPart("domain"); + protected string? ServiceAccountDomain => GetServiceAccountPart("domain"); - // ReSharper disable once InconsistentNaming - protected string? serviceAccountName => GetServiceAccountPart("user"); + protected string? ServiceAccountName => GetServiceAccountPart("user"); public string? ServiceAccountPassword => GetServiceAccountPart("password"); - public string ServiceAccountUser => (serviceAccountDomain ?? "NULL") + @"\" + (serviceAccountName ?? "NULL"); + public string? ServiceAccountUser => ServiceAccountName is null ? null : (ServiceAccountDomain ?? ".") + "\\" + ServiceAccountName; public bool HasServiceAccount() { - return !string.IsNullOrEmpty(serviceAccountDomain) && !string.IsNullOrEmpty(serviceAccountName); + return !string.IsNullOrEmpty(ServiceAccountName); } public bool AllowServiceAcountLogonRight