-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.go
More file actions
38 lines (29 loc) · 846 Bytes
/
server.go
File metadata and controls
38 lines (29 loc) · 846 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
33
34
35
36
37
38
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"github.com/applait/xplex-agent/rest"
"github.com/spf13/viper"
)
func init() {
// Set viper path and read configuration
viper.AddConfigPath(".")
viper.SetConfigName("config")
err := viper.ReadInConfig()
// Handle errors reading the config file
if err != nil {
log.Fatalln("Fatal error config file", err)
}
}
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
// Cron polls rig every n minutes with current streams info and execute action based on response
// DISABLED ATM
// cron.Start()
// Rest defines nginx callback handlers and stats endpoints
rest.Start()
// Agent HTTP interface for Rig and Nginx
log.Printf("Agent | Port %s", viper.GetString("server.port"))
log.Fatal(http.ListenAndServe(":"+viper.GetString("server.port"), rest.Start()))
}