Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wlsaud619 committed Oct 8, 2019
1 parent 35be169 commit 85e13e0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ network = "cosmos"

# RPC-Server
[rpc]
address = "113.209.186.219:26657"
address = "localhost:26657"

# Rest-server
[rest_server]
address = "113.209.186.219:1317"
address = "localhost:1317"

[validator_info]
operatorAddress = "cosmosvaloper14l0fp639yudfl46zauvv8rkzjgd4u0zk2aseys"
Expand Down
35 changes: 27 additions & 8 deletions function/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func Init() {

var config = readConfig()

fmt.Printf("\033[7m##### %s #####\033[0m\n", config.Title)
fmt.Printf("\033[7m##### Exporter Start #####\033[0m\n\n")

t.RpcServer = config.Rpc.Address
t.RestServer = config.Rest_server.Address
Expand All @@ -30,7 +30,7 @@ func Init() {
t.OutputPrint = config.Option.OutputPrint
t.Bech32MainPrefix = config.Network

fmt.Println("\n[ Your Info ]")
fmt.Println("\n[ Your Info]")
fmt.Println("- Network:", config.Network)
fmt.Println("- RPC Server Address:", config.Rpc.Address)
fmt.Println("- Rest Server Address:", config.Rest_server.Address)
Expand Down Expand Up @@ -69,16 +69,35 @@ func readConfig() t.Config {

func serverChecker() {

fmt.Println("serverChecker")
fmt.Printf("RPC-Server Check..")
cmd := "curl -s -XGET " + t.RpcServer + "/abci_info" +" -H \"accept:application/json\""
cmdRun := exec.Command("/bin/bash", "-c", cmd)
timer(cmdRun)

cmd := "curl -s -XGET " + t.RpcServer + "/abci_info" +" -H \"accept:application/json\""
out, _ := exec.Command("/bin/bash", "-c", cmd).Output()
fmt.Println(string(out))

fmt.Printf("Rest-Server Check..")
cmd = "curl -s -XGET " + t.RestServer + "/node_info" +" -H \"accept:application/json\""
out, _ = exec.Command("/bin/bash", "-c", cmd).Output()
fmt.Println(string(out))
cmdRun = exec.Command("/bin/bash", "-c", cmd)
timer(cmdRun)
}

func timer(cmdRun *exec.Cmd) {

if err := cmdRun.Start(); err != nil {
log.Fatal(err)
}

timer := time.AfterFunc(5 * time.Second, func() {
cmdRun.Process.Kill()
})

if err := cmdRun.Wait(); err != nil {

fmt.Println("Failure!")
panic("Error !!!")
} else {
fmt.Println("Success!")
}

timer.Stop()
}
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ go 1.12

require (
github.com/BurntSushi/toml v0.3.1
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/prometheus/client_golang v1.1.0
github.com/tendermint/tendermint v0.32.3
)

0 comments on commit 85e13e0

Please sign in to comment.