Initial commit
This commit is contained in:
commit
2fa110e760
28 changed files with 2346 additions and 0 deletions
35
internal/app/app.go
Normal file
35
internal/app/app.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
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")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue