-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.go
54 lines (43 loc) · 1.05 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
50
51
52
53
54
package main
import (
"log"
"os"
"github.com/dorajistyle/goyangi/db"
"github.com/dorajistyle/goyangi/script"
"github.com/dorajistyle/goyangi/server"
"github.com/spf13/viper"
"github.com/urfave/cli"
)
func init() {
viper.AddConfigPath(".")
viper.SetConfigType("yaml")
// switch os.Getenv("ENV") {
// case "DEVELOPMENT":
// viper.SetConfigName(".env.dev")
// case "TEST":
// viper.SetConfigName(".env.test")
// case "PRODUCTION":
// viper.SetConfigName(".env.prod")
// }
viper.SetConfigName("config.yml")
viper.AutomaticEnv()
if err := viper.ReadInConfig(); err != nil {
log.Fatalln("Fatal error config file", err)
}
}
func main() {
app := cli.NewApp()
app.Name = "Goyangi script tool"
app.Usage = "run scripts!"
app.Version = "0.1.0"
app.Author = "https://github.com/dorajistyle(JoongSeob Vito Kim)"
app.Commands = script.Commands()
app.Action = func(c *cli.Context) {
println("Run Server.")
println(viper.GetString("app.name"))
server.Run()
}
println(viper.GetString("database.type"))
db.GormInit()
app.Run(os.Args)
}