59 lines
1.2 KiB
Go
59 lines
1.2 KiB
Go
// Package classification Click 'n' Join Storage API Documentation.
|
||
//
|
||
// Schemes: https
|
||
// Host: storage.clickandjoin.umbach.dev
|
||
// BasePath: /v1
|
||
// Version: 0.0.1
|
||
//
|
||
// Consumes:
|
||
// - application/json
|
||
//
|
||
// Produces:
|
||
// - application/json
|
||
//
|
||
// swagger:meta
|
||
package main
|
||
|
||
import (
|
||
"clickandjoin.app/storageserver/modules/config"
|
||
"clickandjoin.app/storageserver/modules/scylladb"
|
||
"clickandjoin.app/storageserver/routers/router"
|
||
gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper"
|
||
"github.com/gofiber/fiber/v2"
|
||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||
"github.com/gofiber/fiber/v2/middleware/logger"
|
||
)
|
||
|
||
func init() {
|
||
config.LoadConfig()
|
||
|
||
cfg := config.Cfg
|
||
|
||
gocnjhelper.InitLogger(config.Cfg.Debug,
|
||
true,
|
||
true,
|
||
gocnjhelper.GetConnectionString(cfg.RabbitMq.Username, cfg.RabbitMq.Password, cfg.RabbitMq.Host),
|
||
cfg.ServiceName,
|
||
cfg.ServiceType)
|
||
|
||
scylladb.InitDatabase()
|
||
}
|
||
|
||
func main() {
|
||
app := fiber.New()
|
||
|
||
app.Use(cors.New())
|
||
|
||
cfg := config.Cfg
|
||
|
||
if cfg.Debug {
|
||
app.Use(logger.New(logger.Config{
|
||
Format: "${pid} ${locals:requestid} ${status} - ${method} ${path}\n",
|
||
}))
|
||
}
|
||
|
||
router.SetupRoutes(app)
|
||
|
||
app.Listen(cfg.Host + ":" + cfg.Port)
|
||
}
|