This commit is contained in:
insanity@loafle.com 2017-05-19 11:26:14 +09:00
parent 8a41b8a835
commit 603f8656e2

View File

@ -1,6 +1,8 @@
package main
import (
log "github.com/cihub/seelog"
"loafle.com/overflow/agent/bootstrap"
"loafle.com/overflow/agent_api/config_manager"
msg "loafle.com/overflow/agent_api/messages"
col "loafle.com/overflow/collector_go"
@ -8,10 +10,9 @@ import (
crm "loafle.com/overflow/crawler_manager_go"
dat "loafle.com/overflow/data_sender_go"
evt "loafle.com/overflow/event_sender_go"
ini "loafle.com/overflow/initializer_go"
pol "loafle.com/overflow/long_poller_go"
log "github.com/cihub/seelog"
"sync"
"loafle.com/overflow/agent/bootstrap"
)
const (
@ -30,6 +31,7 @@ func main() {
type Agent struct {
cm config_manager.ConfigManager
taskCh chan interface{}
secKey string
}
func StartAgent() {
@ -52,6 +54,14 @@ func (agt *Agent) startAgent() {
}
globalConf := <-cfgStarted
// ini start()
iniStarted := make(chan string, 1)
if err := ini.Start(iniStarted, globalConf); err != nil {
log.Error(err)
return
}
agt.secKey = <-iniStarted
//2. evt start()
evtStarted := make(chan bool, 1)
if err := evt.Start(evtStarted); err != nil {
@ -75,12 +85,12 @@ func (agt *Agent) startAgent() {
agt.taskCh = pol.GetTaskCh()
/**
Todo : Getting an auth key from API server.
*/
Todo : Getting an auth key from API server.
*/
//5. scm start()
scmStarted := make(chan config_manager.ConfigManager, 1)
if err := cfg.StartSensorConfig(scmStarted, "temp"); err != nil {
if err := cfg.StartSensorConfig(scmStarted, agt.secKey); err != nil {
log.Error(err)
return
}