feat(mail): #132 unify env variables and send mails with smtp
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 46s

This commit is contained in:
Tim
2024-09-06 16:17:49 +02:00
parent 2c23a508ec
commit 6669e4adab
7 changed files with 105 additions and 22 deletions

31
main.go
View File

@@ -20,6 +20,7 @@ func main() {
if err != nil {
log.Fatal("Error loading .env file")
}
utils.MustInitEnv()
db, err := sql.Open("sqlite3", "./data.db")
if err != nil {
@@ -27,19 +28,9 @@ func main() {
}
defer db.Close()
utils.RunMigrations(db)
utils.MustRunMigrations(db)
var prometheusServer = http.Server{
Addr: ":8081",
Handler: promhttp.Handler(),
}
go func() {
slog.Info("Starting prometheus server on " + prometheusServer.Addr)
err := prometheusServer.ListenAndServe()
if err != nil {
panic(err)
}
}()
startPrometheus()
var server = http.Server{
Addr: ":8080",
@@ -52,3 +43,19 @@ func main() {
panic(err)
}
}
func startPrometheus() {
var prometheusServer = http.Server{
Addr: ":8081",
Handler: promhttp.Handler(),
}
go func() {
slog.Info("Starting prometheus server on " + prometheusServer.Addr)
err := prometheusServer.ListenAndServe()
if err != nil {
log.Fatal("Could not start prometheus server: ", err)
}
}()
}