serverctl/services/entry/cmd/app/main.go

29 lines
631 B
Go
Raw Normal View History

2022-02-16 16:27:48 +01:00
package app
import (
"serverctl/pkg/api"
"serverctl/pkg/infrastructure"
"serverctl/pkg/infrastructure/dependencies"
2022-02-23 22:39:04 +01:00
"serverctl/pkg/infrastructure/queue"
2022-02-16 16:27:48 +01:00
)
2022-02-17 12:57:45 +01:00
// Run main app, will bootstrap dependencies and run all external ports (http servers, queues, etc).
2022-02-16 16:27:48 +01:00
func Run() {
d := dependencies.New()
d.Logger.Info("Starting serverctl")
2022-02-23 22:39:04 +01:00
queue.NewRabbitMQ(d.Logger, &queue.RabbitMqConfig{
Username: "serverctl",
Password: "serverctlsecret",
Host: "rabbitmq",
Port: 5672,
})
2022-02-17 12:57:45 +01:00
// if development add seed data
2022-02-16 16:27:48 +01:00
infrastructure.AddSeedData(d.Database, d.Logger)
api.
NewServerctlApi(d).
SetupApi().
RunApi()
}