using System.Security.Cryptography.X509Certificates; namespace IOL.GreatOffice.Api.Data.Models; public class AppConfiguration { /// /// An reachable ip address or url that points to a postgres database. /// public string DB_HOST { get; set; } /// /// The port number to use with DB_HOST to point to the postgres database. /// public string DB_PORT { get; set; } /// /// The database user to authenticate against postgres with. /// public string DB_USER { get; set; } /// /// The password for the database user to authenticate against postgres with. /// public string DB_PASSWORD { get; set; } /// /// The name of the main app database. /// public string DB_NAME { get; set; } /// /// An reachable ip address or url that points to a postgres(quartz) database. /// public string QUARTZ_DB_HOST { get; set; } /// /// The port number to use with QUARTZ_DB_HOST to point to the postgres(quartz) database. /// public string QUARTZ_DB_PORT { get; set; } /// /// The database user to authenticate against postgres(quartz) with. /// public string QUARTZ_DB_USER { get; set; } /// /// The password for the database user to authenticate against postgres(quartz) with. /// public string QUARTZ_DB_PASSWORD { get; set; } /// /// The name of the quartz database. /// public string QUARTZ_DB_NAME { get; set; } public string SEQ_API_KEY { get; set; } public string SEQ_API_URL { get; set; } public string SMTP_HOST { get; set; } public string SMTP_PORT { get; set; } public string SMTP_USER { get; set; } public string SMTP_PASSWORD { get; set; } public string EMAIL_FROM_ADDRESS { get; set; } public string EMAIL_FROM_DISPLAY_NAME { get; set; } public string PORTAL_URL { get; set; } public string GITHUB_CLIENT_ID { get; set; } public string GITHUB_CLIENT_SECRET { get; set; } public string APP_AES_KEY { get; set; } /// /// A base64 string containing a passwordless pfx cert /// public string APP_CERT { get; set; } public X509Certificate2 CERT1() => new(Convert.FromBase64String(APP_CERT)); public object GetPublicVersion() { return new { DB_HOST, DB_PORT, DB_USER, DB_PASSWORD = DB_PASSWORD.Obfuscate() ?? "", QUARTZ_DB_HOST, QUARTZ_DB_PORT, QUARTZ_DB_USER, QUARTZ_DB_PASSWORD = QUARTZ_DB_PASSWORD.Obfuscate() ?? "", SEQ_API_KEY = SEQ_API_KEY.Obfuscate() ?? "", SEQ_API_URL, SMTP_HOST, SMTP_PORT, SMTP_USER = SMTP_USER.Obfuscate() ?? "", SMTP_PASSWORD = SMTP_PASSWORD.Obfuscate() ?? "", EMAIL_FROM_ADDRESS, EMAIL_FROM_DISPLAY_NAME, PORTAL_URL, GITHUB_CLIENT_ID = GITHUB_CLIENT_ID.Obfuscate() ?? "", GITHUB_CLIENT_SECRET = GITHUB_CLIENT_SECRET.Obfuscate() ?? "", APP_AES_KEY = APP_AES_KEY.Obfuscate() ?? "", CERT1 = CERT1().PublicKey.Oid.FriendlyName }; } }