chore: add live smtp settings

This commit is contained in:
kekskurse 2025-03-14 17:46:49 +01:00
parent a5d6c6b9d4
commit f5309ca676
5 changed files with 18 additions and 22 deletions
.gitignore
.woodpecker
pkg/userstore/migrations
resources/infra
templates

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
test.db
db.sh
live-db-migrate.sh

View file

@ -19,10 +19,16 @@ steps:
SCW_ACCESS_KEY:
from_secret: scw_access_key
USERSTORE_SQLITE_PATH:
from_secret: userstore_sqlite_path
from_secret: userstore_sqlite_path2
SMTP_PASSWORD:
from_secret: smtp_password
SMTP_USERNAME:
from_secret: smtp_username
commands:
- cd resources/infra
- terraform init
- sed -i 's@git.keks.cloud/kekskurse/miniauth:latest@git.keks.cloud/kekskurse/miniauth:${CI_COMMIT_SHA}@g' scw-container.tf
- sed -i s@USERSTORE_SQLITE_PATH_SED@$USERSTORE_SQLITE_PATH@g scw-container.tf
- sed -i s@SMTP_USERNAME_SED@$SMTP_USERNAME@g scw-container.tf
- sed -i s@SMTP_PASSWORD_SED@$SMTP_PASSWORD@g scw-container.tf
- terraform apply -auto-approve

View file

@ -1,26 +1,9 @@
--
-- Sqlite SQL Schema dump automatic generated by geni
-- LibSQL SQL Schema dump automatic generated by geni
--
CREATE TABLE schema_migrations (id VARCHAR(255) PRIMARY KEY);
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
username TEXT NOT NULL UNIQUE,
password TEXT NOT NULL
);
CREATE TABLE schema_migrations (id VARCHAR(255) NOT NULL PRIMARY KEY);
CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, username TEXT NOT NULL UNIQUE, password TEXT NOT NULL);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE mail (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
user_id INTEGER NOT NULL,
mail TEXT NOT NULL UNIQUE,
validation_code TEXT NOT NULL UNIQUE,
is_validated BOOLEAN NOT NULL DEFAULT 0,
is_primary BOOLEAN NOT NULL DEFAULT 0,
FOREIGN KEY(user_id) REFERENCES users(id)
);
CREATE TABLE mail (id INTEGER PRIMARY KEY AUTOINCREMENT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, user_id INTEGER NOT NULL, mail TEXT NOT NULL UNIQUE, validation_code TEXT NOT NULL UNIQUE, is_validated BOOLEAN NOT NULL DEFAULT 0, is_primary BOOLEAN NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users (id));

View file

@ -23,8 +23,12 @@ resource "scaleway_container" "main" {
environment_variables = {
"WEB_PUBLIC_REGISTRATION" = "1"
"SMTP_SERVER" = "smtp.tem.scw.cloud"
"SMTP_FROM" = "auth@gutes.team"
}
secret_environment_variables = {
"USERSTORE_SQLITE_PATH" = "USERSTORE_SQLITE_PATH_SED"
"SMTP_USERNAME" = "SMTP_USERNAME_SED"
"SMTP_PASSWORD" = "SMTP_PASSWORD_SED"
}
}

View file

@ -9,9 +9,11 @@
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
<div class="bg-white p-8 shadow-xl w-full max-w-md">
<h2 class="text-2xl font-semibold text-gray-900 text-center mb-6">Registrieren</h2>
{{ if msg }}
<div id="global-error" class=" bg-red-100 text-red-700 p-3 text-center mb-4 border border-red-400">
{{ .msg }}
</div>
{{ end }}
<form action="#" method="POST" class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium text-gray-700">Benutzername</label>