-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathcore.go
38 lines (32 loc) · 872 Bytes
/
core.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package fxcore
import (
"github.com/ankorstore/yokai/config"
"github.com/ankorstore/yokai/healthcheck"
"github.com/labstack/echo/v4"
)
// Core is the core component, holding the core config, health checker and http server.
type Core struct {
config *config.Config
checker *healthcheck.Checker
httpServer *echo.Echo
}
// NewCore returns a new [Core].
func NewCore(config *config.Config, checker *healthcheck.Checker, httpServer *echo.Echo) *Core {
return &Core{
config: config,
checker: checker,
httpServer: httpServer,
}
}
// Config returns the core config.
func (c *Core) Config() *config.Config {
return c.config
}
// Checker returns the core health checker.
func (c *Core) Checker() *healthcheck.Checker {
return c.checker
}
// HttpServer returns the core http server.
func (c *Core) HttpServer() *echo.Echo {
return c.httpServer
}