mirror of
https://github.com/dragonheim/gagent.git
synced 2025-04-26 02:18:59 -07:00
fix: was using struct member for two different things.
This commit is contained in:
parent
7a9225ce86
commit
db351f3892
5 changed files with 18 additions and 24 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
log "log"
|
||||
os "os"
|
||||
regexp "regexp"
|
||||
strconv "strconv"
|
||||
strings "strings"
|
||||
sync "sync"
|
||||
time "time"
|
||||
|
@ -33,9 +34,9 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
|
|||
var err error
|
||||
|
||||
if config.CMode {
|
||||
agent.ScriptCode, err = ioutil.ReadFile(config.File)
|
||||
agent.ScriptCode, err = ioutil.ReadFile(config.Agent)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] No such file or directory: %s", config.File)
|
||||
log.Printf("[ERROR] No such file or directory: %s", config.Agent)
|
||||
os.Exit(4)
|
||||
}
|
||||
log.Printf("[DEBUG] Agent file contents: \n----- -----\n%s\n----- -----\n", agent.ScriptCode)
|
||||
|
@ -56,7 +57,7 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
|
|||
if config.Routers[key].ClientPort != 0 {
|
||||
rport = config.Routers[key].ClientPort
|
||||
}
|
||||
connectString := fmt.Sprintf("tcp://%s:%d", config.Routers[key].RouterAddr, rport)
|
||||
connectString := "tcp://" + config.Routers[key].RouterAddr + ":" + strconv.Itoa(rport)
|
||||
|
||||
wg.Add(1)
|
||||
go sendAgent(wg, config.UUID, connectString, agent)
|
||||
|
|
|
@ -18,6 +18,7 @@ type GagentConfig struct {
|
|||
Workers []*WorkerDetails `hcl:"worker,block"`
|
||||
Version string
|
||||
File string
|
||||
Agent string
|
||||
CMode bool
|
||||
}
|
||||
|
||||
|
|
|
@ -10,17 +10,10 @@ import (
|
|||
gcdb "github.com/dragonheim/gagent/internal/chaindb"
|
||||
gstructs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
|
||||
prometheus "github.com/prometheus/client_golang/prometheus"
|
||||
promauto "github.com/prometheus/client_golang/prometheus/promauto"
|
||||
|
||||
zmq "github.com/pebbe/zmq4"
|
||||
)
|
||||
|
||||
var (
|
||||
opsProcessed = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "client_requests_received",
|
||||
})
|
||||
|
||||
db gcdb.GagentDb
|
||||
)
|
||||
|
||||
|
@ -144,7 +137,6 @@ func unwrap(msg []string) (head string, tail []string) {
|
|||
|
||||
func answerClient(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
opsProcessed.Inc()
|
||||
/*
|
||||
* fmt.Fprintf(w, "%v\n", r)
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue