2022-08-29 18:30:36 -08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-10-29 20:05:38 -08:00
|
|
|
"github.com/hay-kot/homebox/backend/internal/core/services"
|
2023-08-02 13:00:57 -08:00
|
|
|
"github.com/hay-kot/homebox/backend/internal/core/services/reporting/eventbus"
|
2022-10-29 20:05:38 -08:00
|
|
|
"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"
|
2022-09-24 11:33:38 -08:00
|
|
|
"github.com/hay-kot/homebox/backend/pkgs/mailer"
|
2022-08-29 18:30:36 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
type app struct {
|
|
|
|
conf *config.Config
|
|
|
|
mailer mailer.Mailer
|
|
|
|
db *ent.Client
|
|
|
|
repos *repo.AllRepos
|
|
|
|
services *services.AllServices
|
2023-08-02 13:00:57 -08:00
|
|
|
bus *eventbus.EventBus
|
2022-08-29 18:30:36 -08:00
|
|
|
}
|
|
|
|
|
2022-09-03 19:27:02 -08:00
|
|
|
func new(conf *config.Config) *app {
|
2022-08-29 18:30:36 -08:00
|
|
|
s := &app{
|
|
|
|
conf: conf,
|
|
|
|
}
|
|
|
|
|
|
|
|
s.mailer = mailer.Mailer{
|
|
|
|
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
|
|
|
|
}
|