-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.go
More file actions
32 lines (26 loc) · 834 Bytes
/
start.go
File metadata and controls
32 lines (26 loc) · 834 Bytes
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
package tinygithub
import (
"github.com/adlternative/tinygithub/pkg/config"
service_manager "github.com/adlternative/tinygithub/pkg/manager"
"github.com/adlternative/tinygithub/pkg/model"
"github.com/adlternative/tinygithub/pkg/router"
"github.com/adlternative/tinygithub/pkg/storage"
"github.com/spf13/viper"
)
func Run() error {
dbEngine := model.NewDBEngine()
err := dbEngine.WithUserName(viper.GetString(config.DBUser)).
WithPassword(viper.GetString(config.DBPassword)).
WithIp(viper.GetString(config.DBIp)).
WithPort(viper.GetString(config.DBPort)).
WithDBName(viper.GetString(config.DBName)).Run()
if err != nil {
return err
}
store, err := storage.NewStorage()
if err != nil {
return err
}
manager := service_manager.New().WithStorage(store).WithDBEngine(dbEngine)
return router.Run(manager)
}