-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (35 loc) · 1.16 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"github.com/alrusov/launcher"
"github.com/alrusov/panic"
"github.com/alrusov/stdhttp"
"github.com/alrusov/balance-collector/internal/config"
"github.com/alrusov/balance-collector/internal/http"
// sqlite driver
_ "github.com/mattn/go-sqlite3"
)
//----------------------------------------------------------------------------------------------------------------------------//
type app struct {
cfg *config.Config
}
//----------------------------------------------------------------------------------------------------------------------------//
func (a *app) CheckConfig() error {
return a.cfg.Check()
}
func (a *app) NewListener() (*stdhttp.HTTP, error) {
h, err := http.NewHTTP(a.cfg)
if err != nil {
return nil, err
}
return h, nil
}
//----------------------------------------------------------------------------------------------------------------------------//
func main() {
panicID := panic.ID()
defer panic.SaveStackToLogEx(panicID)
app := &app{
cfg: &config.Config{},
}
launcher.Go(app, app.cfg)
}
//----------------------------------------------------------------------------------------------------------------------------//