forked from man-group/dapr-sidekick-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDaprSentryOptions.cs
78 lines (65 loc) · 2.64 KB
/
DaprSentryOptions.cs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
namespace Man.Dapr.Sidekick
{
public class DaprSentryOptions : Options.DaprProcessOptions
{
public DaprSentryOptions()
{
HealthPort = 8080;
}
/// <summary>
/// Gets or sets the path to the Dapr configuration file. If a filename is not specified the default value "config.yaml" will be used.
/// If a directory is not specified a directory called "dapr" under the current executing assembly location will be assumed.
/// </summary>
public string ConfigFile { get; set; }
/// <summary>
/// Gets or sets custom arguments for the process. These will be appended "as-is" after all other arguments specified through these options.
/// </summary>
public string CustomArguments { get; set; }
/// <summary>
/// Gets or sets a value that determines if Prometheus metrics are enabled in the service (default true).
/// </summary>
public bool? EnableMetrics { get; set; }
/// <summary>
/// Gets the HTTP port for the health server (default 8080).
/// </summary>
public int? HealthPort { get; internal set; } // Internal for now for testing, as cannot yet be set on sentry.exe
/// <summary>
/// Gets or sets the path to the credentials directory holding the issuer data.
/// If not specified this will default to a directory called "certs" under the runtime folder.
/// </summary>
public string CertsDirectory { get; set; }
/// <summary>
/// Gets or sets the port for the metrics server (default "9092").
/// </summary>
public int? MetricsPort { get; set; }
/// <summary>
/// Gets or sets the CA trust domain (default "localhost").
/// </summary>
public string TrustDomain { get; set; }
/// <summary>
/// Creates a deep clone of this instance.
/// </summary>
/// <returns>A deep clone of this insteance.</returns>
public new DaprSentryOptions Clone() => (DaprSentryOptions)base.Clone();
protected override bool AddHealthUri(UriBuilder builder)
{
if (!HealthPort.HasValue)
{
return false;
}
builder.Port = HealthPort.Value;
builder.Path = "healthz";
return true;
}
protected override bool AddMetricsUri(UriBuilder builder)
{
if (!MetricsPort.HasValue || EnableMetrics == false)
{
return false;
}
builder.Port = MetricsPort.Value;
return true;
}
}
}