plakken/main.go

39 lines
814 B
Go
Raw Normal View History

package main
import (
"embed"
"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"
2024-05-16 15:49:01 +02:00
"log"
"time"
)
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()
}