/
main.go
38 lines (34 loc) · 790 Bytes
/
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
package main
import (
"log"
"os"
"path/filepath"
"strings"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/mtricht/trello-burndown/pkg/server"
"github.com/mtricht/trello-burndown/pkg/trello"
"github.com/spf13/viper"
)
func init() {
binaryPath, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
log.Fatal(err)
}
viper.AddConfigPath(binaryPath)
viper.AddConfigPath(".")
viper.SetConfigName("config")
err = viper.ReadInConfig()
if err != nil {
log.Println(err)
}
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.WatchConfig()
viper.SetDefault("http.readOnly", false)
log.SetFlags(log.LstdFlags | log.Lshortfile)
}
func main() {
go server.Start()
trello.Start()
}