Mode from main
This commit is contained in:
parent
c3946df1ff
commit
f5fee55905
@ -6,10 +6,12 @@ import (
|
|||||||
"serverctl/pkg/infrastructure/dependencies"
|
"serverctl/pkg/infrastructure/dependencies"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Run main app, will bootstrap dependencies and run all external ports (http servers, queues, etc).
|
||||||
func Run() {
|
func Run() {
|
||||||
d := dependencies.New()
|
d := dependencies.New()
|
||||||
d.Logger.Info("Starting serverctl")
|
d.Logger.Info("Starting serverctl")
|
||||||
|
|
||||||
|
// if development add seed data
|
||||||
infrastructure.AddSeedData(d.Database, d.Logger)
|
infrastructure.AddSeedData(d.Database, d.Logger)
|
||||||
|
|
||||||
api.
|
api.
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
// Used for profiling
|
// Used for profiling
|
||||||
import _ "net/http/pprof"
|
import _ "net/http/pprof"
|
||||||
|
|
||||||
|
// ServerctlApi contains everything required for the api to run
|
||||||
type ServerctlApi struct {
|
type ServerctlApi struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
router *gin.Engine
|
router *gin.Engine
|
||||||
@ -19,6 +20,7 @@ type ServerctlApi struct {
|
|||||||
dependencies *dependencies.Dependencies
|
dependencies *dependencies.Dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServerctlApi Creates a new api struct
|
||||||
func NewServerctlApi(dependencies *dependencies.Dependencies) *ServerctlApi {
|
func NewServerctlApi(dependencies *dependencies.Dependencies) *ServerctlApi {
|
||||||
return &ServerctlApi{dependencies: dependencies}
|
return &ServerctlApi{dependencies: dependencies}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user