57 lines
1.1 KiB
Go
57 lines
1.1 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 (
|
||
"log"
|
||
"os"
|
||
|
||
"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()
|
||
|
||
gocnjhelper.InitLogger(config.Cfg.Debug, true, true)
|
||
|
||
scylladb.InitDatabase()
|
||
}
|
||
|
||
func main() {
|
||
app := fiber.New()
|
||
|
||
app.Use(cors.New())
|
||
|
||
if config.Cfg.Debug {
|
||
app.Use(logger.New(logger.Config{
|
||
Format: "${pid} ${locals:requestid} ${status} - ${method} ${path}\n",
|
||
}))
|
||
}
|
||
|
||
router.SetupRoutes(app)
|
||
|
||
if len(os.Args) < 2 {
|
||
log.Fatalln("Please specify port")
|
||
}
|
||
|
||
app.Listen("127.0.0.1:" + os.Args[1])
|
||
}
|