blob: 4db84e07d4c9e7c193936b1ad60e84561cb81c69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
using PKISharp.WACS.DomainObjects;
using PKISharp.WACS.Plugins.Base.Factories;
using PKISharp.WACS.Services;
using System;
using System.Threading.Tasks;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Http
{
internal class SelfHostingOptionsFactory : ValidationPluginOptionsFactory<SelfHosting, SelfHostingOptions>
{
private readonly IArgumentsService _arguments;
private readonly IUserRoleService _userRoleService;
public SelfHostingOptionsFactory(IArgumentsService arguments, IUserRoleService userRoleService)
{
_arguments = arguments;
_userRoleService = userRoleService;
}
public override (bool, string?) Disabled => SelfHosting.IsDisabled(_userRoleService);
public override Task<SelfHostingOptions?> Aquire(Target target, IInputService inputService, RunLevel runLevel) => Default(target);
public override async Task<SelfHostingOptions?> Default(Target target)
{
var args = _arguments.GetArguments<SelfHostingArguments>();
return new SelfHostingOptions()
{
Port = args?.ValidationPort,
Https = string.Equals(args?.ValidationProtocol, "https", StringComparison.OrdinalIgnoreCase) ? true : (bool?)null
};
}
}
}
|