namespace bitforum.Models { public static class Setting { public static AppConfig AppConfig { get; private set; } = new(); public static ConnectionStrings ConnectionStrings { get; private set; } = new(); public static Redis Redis { get; private set; } = new(); public static Smtp Smtp { get; private set; } = new(); public static Jwt Jwt { get; private set; } = new(); static Setting() { var appSettings = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build(); appSettings.GetSection("AppConfig").Bind(AppConfig); appSettings.GetSection("ConnectionStrings").Bind(ConnectionStrings); appSettings.GetSection("Redis").Bind(Redis); appSettings.GetSection("Smtp").Bind(Smtp); appSettings.GetSection("JWT").Bind(Jwt); } } public class AppConfig { public string AppName { get; set; } = null!; public string AppVersion { get; set; } = null!; public string BaseURL { get; set; } = null!; } public class ConnectionStrings { public string DefaultConnection { get; set; } = null!; } public class Redis { public string Host { get; set; } = null!; public int Port { get; set; } public string Password { get; set; } = null!; } public class Smtp { public string Server { get; set; } = null!; public int Port { get; set; } public bool EnableSSL { get; set; } public string Username { get; set; } = null!; public string Password { get; set; } = null!; public string FromEmail { get; set; } = null!; public string FromName { get; set; } = null!; } public class Jwt { public string SecretKey { get; set; } = null!; public string Issuer { get; set; } = null!; public string Audience { get; set; } = null!; public int AccessTokenExpiration { get; set; } public int RefreshTokenExpiration { get; set; } } }