mirror of
https://github.com/Chipazawra/v8-1c-cluster-pde.git
synced 2024-12-27 01:34:09 +02:00
dev
This commit is contained in:
parent
e9a3bcd744
commit
a7e2467c35
@ -1,7 +1,49 @@
|
||||
package app
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/caarlos0/env"
|
||||
rclient "github.com/khorevaa/ras-client"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
var (
|
||||
conf Config
|
||||
hostFlag string
|
||||
portFlag string
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := env.Parse(&conf); err != nil {
|
||||
log.Fatalf("app: config...")
|
||||
}
|
||||
|
||||
flag.StringVar(&hostFlag, "host", "", "cluster host.")
|
||||
flag.StringVar(&portFlag, "port", "", "cluster port.")
|
||||
flag.Parse()
|
||||
|
||||
if hostFlag != "" {
|
||||
conf.Host = hostFlag
|
||||
}
|
||||
|
||||
if portFlag != "" {
|
||||
conf.Port = portFlag
|
||||
}
|
||||
}
|
||||
|
||||
func Run() error {
|
||||
|
||||
_ = rclient.NewClient(fmt.Sprintf("%s:%s", conf.Host, conf.Port))
|
||||
|
||||
promRegistry := prometheus.NewRegistry()
|
||||
promRegistry.MustRegister()
|
||||
http.Handle("/metrics", promhttp.HandlerFor(promRegistry, promhttp.HandlerOpts{}))
|
||||
|
||||
return fmt.Errorf("app: not implemented")
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user