homebox/backend/app/api/app.go

36 lines
846 B
Go
Raw Normal View History

2022-08-30 02:30:36 +00:00
package main
import (
"github.com/hay-kot/homebox/backend/internal/core/services"
"github.com/hay-kot/homebox/backend/internal/core/services/reporting/eventbus"
"github.com/hay-kot/homebox/backend/internal/data/ent"
"github.com/hay-kot/homebox/backend/internal/data/repo"
"github.com/hay-kot/homebox/backend/internal/sys/config"
"github.com/hay-kot/homebox/backend/pkgs/mailer"
2022-08-30 02:30:36 +00:00
)
type app struct {
conf *config.Config
2024-03-02 18:02:41 +00:00
mailer *mailer.Mailer
2022-08-30 02:30:36 +00:00
db *ent.Client
repos *repo.AllRepos
services *services.AllServices
bus *eventbus.EventBus
2022-08-30 02:30:36 +00:00
}
2022-09-04 03:27:02 +00:00
func new(conf *config.Config) *app {
2022-08-30 02:30:36 +00:00
s := &app{
conf: conf,
}
2024-03-02 18:02:41 +00:00
s.mailer = &mailer.Mailer{
2022-08-30 02:30:36 +00:00
Host: s.conf.Mailer.Host,
Port: s.conf.Mailer.Port,
Username: s.conf.Mailer.Username,
Password: s.conf.Mailer.Password,
From: s.conf.Mailer.From,
}
return s
}