plakken/main.go

40 lines
815 B
Go
Raw Permalink Normal View History

package main
import (
"embed"
2024-02-21 14:22:40 +01:00
"log"
2024-05-16 15:49:01 +02:00
"time"
"git.gnous.eu/gnouseu/plakken/internal/config"
"git.gnous.eu/gnouseu/plakken/internal/database"
2024-04-10 19:34:36 +02:00
"git.gnous.eu/gnouseu/plakken/internal/httpserver"
)
var (
//go:embed templates
templates embed.FS
//go:embed static
static embed.FS
)
func main() {
initConfig := config.GetConfig()
dbConfig := database.InitDB(initConfig.RedisAddress, initConfig.RedisUser, initConfig.RedisPassword, initConfig.RedisDB)
db := database.ConnectDB(dbConfig)
2024-02-21 14:22:40 +01:00
err := database.Ping(db)
if err != nil {
log.Fatal(err)
}
2024-04-10 19:34:36 +02:00
serverConfig := httpserver.ServerConfig{
HTTPServer: httpserver.Config(initConfig.ListenAddress),
URLLength: initConfig.URLLength,
DB: db,
Static: static,
Templates: templates,
2024-05-16 15:49:01 +02:00
StartTime: time.Now(),
}
serverConfig.Server()
}