using System.Security.Cryptography.X509Certificates; namespace IOL.GreatOffice.Api.Models.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; } /// /// API key to use when pushing logs to SEQ /// public string SEQ_API_KEY { get; set; } /// /// Url pointing to the seq instance that processes server logs /// public string SEQ_API_URL { get; set; } /// /// A token used when sending email via Postmakr /// public string POSTMARK_TOKEN { get; set; } /// /// The address to send emails from, needs to be setup as a sender in postmark /// public string EMAIL_FROM_ADDRESS { get; set; } /// /// The absolute url to the frontend app /// public string CANONICAL_FRONTEND_URL { get; set; } /// /// The absolute url to the backend api /// public string CANONICAL_BACKEND_URL { get; set; } /// /// A random string used to encrypt/decrypt for general purposes /// 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 GetPublicObject() { 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, POSTMARK_TOKEN = POSTMARK_TOKEN.Obfuscate() ?? "", EMAIL_FROM_ADDRESS, APP_AES_KEY = APP_AES_KEY.Obfuscate() ?? "", CERT1 = CERT1().PublicKey.Oid.FriendlyName, CANONICAL_FRONTEND_URL }; } }