Initial commit
This commit is contained in:
42
lib/app/app.go
Normal file
42
lib/app/app.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"source.hodakov.me/hdkv/github-release/lib/settings"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
logger *logrus.Logger
|
||||
settings *settings.Settings
|
||||
}
|
||||
|
||||
func (a *App) Context() context.Context {
|
||||
return a.ctx
|
||||
}
|
||||
|
||||
func (a *App) Logger() *logrus.Logger {
|
||||
return a.logger
|
||||
}
|
||||
|
||||
func (a *App) Settings() *settings.Settings {
|
||||
return a.settings
|
||||
}
|
||||
|
||||
func Init(ctx context.Context) *App {
|
||||
app := new(App)
|
||||
|
||||
app.settings = new(settings.Settings)
|
||||
|
||||
app.logger = logrus.StandardLogger()
|
||||
app.logger.SetFormatter(&logrus.TextFormatter{
|
||||
FullTimestamp: true,
|
||||
})
|
||||
|
||||
app.ctx = ctx
|
||||
|
||||
return app
|
||||
}
|
||||
Reference in New Issue
Block a user