This repository has been archived by the owner on Jan 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
DiagnosticsConfiguration.cs
72 lines (63 loc) · 2.58 KB
/
DiagnosticsConfiguration.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
namespace Nancy.Diagnostics
{
using Cryptography;
/// <summary>
/// Settings for the diagnostics dashboard
/// </summary>
public class DiagnosticsConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="DiagnosticsConfiguration"/> class,
/// using the <see cref="CryptographyConfiguration.Default"/> cryptographic
/// configuration.
/// </summary>
public DiagnosticsConfiguration()
: this(CryptographyConfiguration.Default)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DiagnosticsConfiguration"/> class,
/// using the <paramref name="cryptographyConfiguration"/> cryptographic
/// configuration.
/// </summary>
/// <param name="cryptographyConfiguration">The <see cref="CryptographyConfiguration"/> to use with diagnostics.</param>
public DiagnosticsConfiguration(CryptographyConfiguration cryptographyConfiguration)
{
this.CookieName = "__ncd";
this.CryptographyConfiguration = cryptographyConfiguration;
this.Path = "/_Nancy";
this.Timeout = 15;
}
/// <summary>
/// Gets or sets the name of the cookie used by the diagnostics dashboard.
/// </summary>
/// <remarks>The default is __ncd</remarks>
public string CookieName { get; set; }
/// <summary>
/// Gets or sets the cryptography config to use for securing the diagnostics dashboard
/// </summary>
public CryptographyConfiguration CryptographyConfiguration { get; set; }
/// <summary>
/// Gets or sets password for accessing the diagnostics screen.
/// This shoudl be secure :-)
/// </summary>
public string Password { get; set; }
/// <summary>
/// Gets or sets the path that the diagnostics dashboard will be accessible on.
/// </summary>
/// <remarks>The default is /_Nancy</remarks>
public string Path { get; set; }
/// <summary>
/// The number of minutes that you stay logged into the diagnostics dashboard.
/// </summary>
/// <remarks>The default is 15 minutes.</remarks>
public int Timeout { get; set; }
/// <summary>
/// Gets a value indicating whether the configuration is valid
/// </summary>
public bool Valid
{
get { return !string.IsNullOrWhiteSpace(this.Password); }
}
}
}