Added database support and update login to utilize db

This commit is contained in:
2025-02-08 19:39:44 +11:00
parent a842d09f96
commit 597fc6f072
8 changed files with 151 additions and 32 deletions

14
main.go
View File

@@ -4,15 +4,18 @@ import (
"context"
"embed"
"fmt"
"github.com/pkg/errors"
"io"
"net"
"net/http"
"os"
"os/signal"
"projectreshoot/server"
"sync"
"time"
"projectreshoot/db"
"projectreshoot/server"
"github.com/pkg/errors"
)
func run(ctx context.Context, w io.Writer) error {
@@ -24,7 +27,12 @@ func run(ctx context.Context, w io.Writer) error {
return errors.Wrap(err, "server.GetConfig")
}
srv := server.NewServer(config)
conn, err := db.ConnectToDatabase(&config.TursoURL, &config.TursoToken)
if err != nil {
return errors.Wrap(err, "db.ConnectToDatabase")
}
srv := server.NewServer(config, conn)
httpServer := &http.Server{
Addr: net.JoinHostPort(config.Host, config.Port),
Handler: srv,