plakken/main.go

38 lines
781 B
Go
Raw Normal View History

package main
import (
"embed"
2024-02-21 14:22:40 +01:00
"log"
"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,
}
serverConfig.Server()
}