From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- code/api/src/Models/Misc/AppConfiguration.cs | 118 +++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 code/api/src/Models/Misc/AppConfiguration.cs (limited to 'code/api/src/Models/Misc/AppConfiguration.cs') diff --git a/code/api/src/Models/Misc/AppConfiguration.cs b/code/api/src/Models/Misc/AppConfiguration.cs new file mode 100644 index 0000000..31e5726 --- /dev/null +++ b/code/api/src/Models/Misc/AppConfiguration.cs @@ -0,0 +1,118 @@ +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; } + + /// + /// 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 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, + POSTMARK_TOKEN = POSTMARK_TOKEN.Obfuscate() ?? "", + EMAIL_FROM_ADDRESS, + APP_AES_KEY = APP_AES_KEY.Obfuscate() ?? "", + CERT1 = CERT1().PublicKey.Oid.FriendlyName, + CANONICAL_FRONTEND_URL + }; + } +} \ No newline at end of file -- cgit v1.3