From 637854699ba81465905b3bbc9ea9560972487c87 Mon Sep 17 00:00:00 2001 From: Fritz Seitz Date: Mon, 16 Dec 2024 19:52:08 -0500 Subject: [PATCH] fix: add additional smtp and service startup --- README.md | 1 + src/Bulwark.Auth/.env | 1 + src/Bulwark.Auth/AppConfig.cs | 2 ++ src/Bulwark.Auth/appsettings.json | 10 ++++++++++ src/Bulwark.Auth/bulwark-auth.service | 12 ++++++++++++ src/Bulwark.Auth/start.sh | 3 +++ 6 files changed, 29 insertions(+) create mode 100644 src/Bulwark.Auth/bulwark-auth.service create mode 100644 src/Bulwark.Auth/start.sh diff --git a/README.md b/README.md index 5469aa2..452bce2 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,4 @@ confidential values should use proper secrets management. | GOOGLE_CLIENT_ID | The google client id to use for google authentication | string | 651882111548-0hrg7e4o90q1iutmfn02qkf9m90k3d3g.apps.googleusercontent.com | No | | | | SERVICE_MODE | The service mode to run in only used for CI and tests | string | test | No | +nano /etc/systemd/system/bulwark-auth.service \ No newline at end of file diff --git a/src/Bulwark.Auth/.env b/src/Bulwark.Auth/.env index 603e49d..3e996a0 100644 --- a/src/Bulwark.Auth/.env +++ b/src/Bulwark.Auth/.env @@ -14,6 +14,7 @@ EMAIL_SMTP_PORT=1025 EMAIL_SMTP_USER=user EMAIL_SMTP_PASS=pass EMAIL_SMTP_SECURE=false +EMAIL_SMTP_AUTH=false VERIFICATION_URL=https://localhost:3000/verify FORGOT_PASSWORD_URL=https://localhost:3000/reset-password MAGIC_LINK_URL=https://localhost:3000/magic-link diff --git a/src/Bulwark.Auth/AppConfig.cs b/src/Bulwark.Auth/AppConfig.cs index 5c2cf30..9e7faba 100644 --- a/src/Bulwark.Auth/AppConfig.cs +++ b/src/Bulwark.Auth/AppConfig.cs @@ -20,6 +20,7 @@ public class AppConfig public string EmailSmtpUser { get; } public string EmailSmtpPass { get; } public bool EmailSmtpSecure { get; } + public bool EmailAuth { get; } public string VerificationUrl { get; } public string ForgotPasswordUrl { get; } public string EmailFromAddress { get; } @@ -57,6 +58,7 @@ public AppConfig() EmailSmtpUser = Environment.GetEnvironmentVariable("EMAIL_SMTP_USER") ?? String.Empty; EmailSmtpPass = Environment.GetEnvironmentVariable("EMAIL_SMTP_PASS") ?? String.Empty; EmailSmtpSecure = Environment.GetEnvironmentVariable("EMAIL_SMTP_SECURE")?.ToLower() == "true"; + EmailAuth = Environment.GetEnvironmentVariable("EMAIL_SMTP_AUTH")?.ToLower() == "true"; } VerificationUrl = Environment.GetEnvironmentVariable("VERIFICATION_URL") ?? diff --git a/src/Bulwark.Auth/appsettings.json b/src/Bulwark.Auth/appsettings.json index d9d9a9b..9b06a9e 100644 --- a/src/Bulwark.Auth/appsettings.json +++ b/src/Bulwark.Auth/appsettings.json @@ -6,5 +6,15 @@ "Microsoft.Hosting.Lifetime": "Information" } }, + "Kestrel": { + "Endpoints": { + "Http": { + "Url": "http://0.0.0.0:80" + }, + "Https": { + "Url": "https://0.0.0.0:443" + } + } + }, "AllowedHosts": "*" } diff --git a/src/Bulwark.Auth/bulwark-auth.service b/src/Bulwark.Auth/bulwark-auth.service new file mode 100644 index 0000000..d3faf2c --- /dev/null +++ b/src/Bulwark.Auth/bulwark-auth.service @@ -0,0 +1,12 @@ +[Unit] +Description=bulwark-auth +After=multi-user.target + +[Service] +WorkingDirectory=/root/Bulwark.Auth/src/Bulwark.Auth/bin/Release/net8.0 +User=root +Group=root +ExecStart=/root/Bulwark.Auth/src/Bulwark.Auth/bin/Release/net8.0/start.sh + +[Install] +WantedBy=multi-user.target diff --git a/src/Bulwark.Auth/start.sh b/src/Bulwark.Auth/start.sh new file mode 100644 index 0000000..6b71dc6 --- /dev/null +++ b/src/Bulwark.Auth/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd "$(dirname "$0")" # Change to the directory of the script (or binary) +exec dotnet Bulwark.Auth.dll "$@"