ms-tester/internal/app/app.go

36 lines
479 B
Go
Raw Normal View History

2024-07-27 07:31:04 +00:00
package app
import (
"log/slog"
"ms-auth/internal/lib"
_ "github.com/jackc/pgx/v5/stdlib"
)
type Server interface {
Start()
GracefullyStop()
}
type App struct {
server Server
cfg *lib.Config
}
func NewApp(cfg *lib.Config, server Server) *App {
return &App{
server: server,
cfg: cfg,
}
}
func (app *App) Start() {
app.server.Start()
slog.Info("app started")
}
func (app *App) GracefullyStop() {
app.server.GracefullyStop()
slog.Info("app stopped")
}