first commit
This commit is contained in:
17
MyNewProjectName.Infrastructure/Options/DatabaseOptions.cs
Normal file
17
MyNewProjectName.Infrastructure/Options/DatabaseOptions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MyNewProjectName.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Database connection configuration options
|
||||
/// </summary>
|
||||
public class DatabaseOptions
|
||||
{
|
||||
public const string SectionName = "ConnectionStrings";
|
||||
|
||||
/// <summary>
|
||||
/// Default database connection string
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "DefaultConnection is required")]
|
||||
public string DefaultConnection { get; set; } = string.Empty;
|
||||
}
|
||||
42
MyNewProjectName.Infrastructure/Options/JwtOptions.cs
Normal file
42
MyNewProjectName.Infrastructure/Options/JwtOptions.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MyNewProjectName.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// JWT authentication configuration options
|
||||
/// </summary>
|
||||
public class JwtOptions
|
||||
{
|
||||
public const string SectionName = "Jwt";
|
||||
|
||||
/// <summary>
|
||||
/// Secret key for signing JWT tokens
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT SecretKey is required")]
|
||||
[MinLength(32, ErrorMessage = "JWT SecretKey must be at least 32 characters long")]
|
||||
public string SecretKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token issuer
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT Issuer is required")]
|
||||
public string Issuer { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token audience
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "JWT Audience is required")]
|
||||
public string Audience { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Token expiration time in minutes
|
||||
/// </summary>
|
||||
[Range(1, 1440, ErrorMessage = "ExpirationInMinutes must be between 1 and 1440 (24 hours)")]
|
||||
public int ExpirationInMinutes { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// Refresh token expiration time in days
|
||||
/// </summary>
|
||||
[Range(1, 365, ErrorMessage = "RefreshTokenExpirationInDays must be between 1 and 365")]
|
||||
public int RefreshTokenExpirationInDays { get; set; } = 7;
|
||||
}
|
||||
24
MyNewProjectName.Infrastructure/Options/RedisOptions.cs
Normal file
24
MyNewProjectName.Infrastructure/Options/RedisOptions.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace MyNewProjectName.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Redis cache configuration options
|
||||
/// </summary>
|
||||
public class RedisOptions
|
||||
{
|
||||
public const string SectionName = "Redis";
|
||||
|
||||
/// <summary>
|
||||
/// Redis connection string
|
||||
/// </summary>
|
||||
public string ConnectionString { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Redis instance name for key prefixing
|
||||
/// </summary>
|
||||
public string InstanceName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Default cache expiration time in minutes
|
||||
/// </summary>
|
||||
public int DefaultExpirationInMinutes { get; set; } = 30;
|
||||
}
|
||||
54
MyNewProjectName.Infrastructure/Options/SerilogOptions.cs
Normal file
54
MyNewProjectName.Infrastructure/Options/SerilogOptions.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
namespace MyNewProjectName.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Serilog logging configuration options
|
||||
/// </summary>
|
||||
public class SerilogOptions
|
||||
{
|
||||
public const string SectionName = "Serilog";
|
||||
|
||||
/// <summary>
|
||||
/// Minimum log level
|
||||
/// </summary>
|
||||
public string MinimumLevel { get; set; } = "Information";
|
||||
|
||||
/// <summary>
|
||||
/// Override log levels for specific namespaces
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Override { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Write to console
|
||||
/// </summary>
|
||||
public bool WriteToConsole { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Write to file
|
||||
/// </summary>
|
||||
public bool WriteToFile { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// File path for logs (relative to application root)
|
||||
/// </summary>
|
||||
public string FilePath { get; set; } = "logs/log-.txt";
|
||||
|
||||
/// <summary>
|
||||
/// Rolling interval for log files
|
||||
/// </summary>
|
||||
public string RollingInterval { get; set; } = "Day";
|
||||
|
||||
/// <summary>
|
||||
/// Retained file count limit
|
||||
/// </summary>
|
||||
public int RetainedFileCountLimit { get; set; } = 31;
|
||||
|
||||
/// <summary>
|
||||
/// Seq server URL (optional)
|
||||
/// </summary>
|
||||
public string? SeqUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Elasticsearch URL (optional)
|
||||
/// </summary>
|
||||
public string? ElasticsearchUrl { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user