forked from Hyperpilotio/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployer.go
42 lines (33 loc) · 776 Bytes
/
deployer.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
package main
import (
"flag"
"os"
"github.com/golang/glog"
"github.com/spf13/viper"
)
// Run start the web server
func Run(fileConfig string) error {
viper := viper.New()
viper.SetConfigType("json")
viper.SetDefault("restartCount", 5)
if fileConfig == "" {
viper.SetConfigName("config")
viper.AddConfigPath("/etc/deployer")
viper.Set("awsId", os.Getenv("AWS_ACCESS_KEY_ID"))
viper.Set("awsSecret", os.Getenv("AWS_SECRET_ACCESS_KEY"))
} else {
viper.SetConfigFile(fileConfig)
}
err := viper.ReadInConfig()
if err != nil {
return err
}
server := NewServer(viper)
return server.StartServer()
}
func main() {
configPath := flag.String("config", "", "The file path to a config file")
flag.Parse()
err := Run(*configPath)
glog.Errorln(err)
}