mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-12-23 12:09:47 +00:00
29 lines
637 B
Go
29 lines
637 B
Go
package handler
|
|
|
|
import (
|
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
type fiberServer struct {
|
|
*fiber.App
|
|
db *database.DB
|
|
}
|
|
|
|
// NewServer returns a new fiber server
|
|
func NewServer() *fiberServer {
|
|
if database.ConnectDB() != nil {
|
|
panic("Failed to connect to database")
|
|
}
|
|
server := &fiberServer{
|
|
App: fiber.New(fiber.Config{
|
|
Prefork: config.AppCfg().Prefork,
|
|
ProxyHeader: config.AppCfg().ProxyHeader,
|
|
AppName: "XMR Nodes Aggregator " + config.Version,
|
|
}),
|
|
db: database.GetDB(),
|
|
}
|
|
|
|
return server
|
|
}
|