Mode from main

This commit is contained in:
Kasper Juul Hermansen 2022-02-17 12:57:45 +01:00
parent c3946df1ff
commit f5fee55905
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
2 changed files with 4 additions and 0 deletions

View File

@ -6,10 +6,12 @@ import (
"serverctl/pkg/infrastructure/dependencies"
)
// Run main app, will bootstrap dependencies and run all external ports (http servers, queues, etc).
func Run() {
d := dependencies.New()
d.Logger.Info("Starting serverctl")
// if development add seed data
infrastructure.AddSeedData(d.Database, d.Logger)
api.

View File

@ -12,6 +12,7 @@ import (
// Used for profiling
import _ "net/http/pprof"
// ServerctlApi contains everything required for the api to run
type ServerctlApi struct {
logger *zap.Logger
router *gin.Engine
@ -19,6 +20,7 @@ type ServerctlApi struct {
dependencies *dependencies.Dependencies
}
// NewServerctlApi Creates a new api struct
func NewServerctlApi(dependencies *dependencies.Dependencies) *ServerctlApi {
return &ServerctlApi{dependencies: dependencies}
}