plakken/main.go
Ada 130a5ee345
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/pr/release Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pull_request_closed/release Pipeline was successful
ci/woodpecker/pull_request_closed/build Pipeline was successful
Add redis connection test before start
2024-02-21 14:34:19 +01:00

37 lines
781 B
Go

package main
import (
"embed"
"log"
"git.gnous.eu/gnouseu/plakken/internal/config"
"git.gnous.eu/gnouseu/plakken/internal/database"
"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)
err := database.Ping(db)
if err != nil {
log.Fatal(err)
}
serverConfig := httpServer.ServerConfig{
HTTPServer: httpServer.Config(initConfig.ListenAddress),
UrlLength: initConfig.UrlLength,
DB: db,
Static: static,
Templates: templates,
}
serverConfig.Server()
}