From bfa656f99f1068424b85ae748a76cbbbaed78a95 Mon Sep 17 00:00:00 2001 From: CMGS Date: Wed, 2 Oct 2019 02:45:38 +0800 Subject: [PATCH] use cli and configor --- .gitignore | 2 +- Dockerfile | 4 +-- Dockerfile.debian | 19 ------------ VERSION | 2 +- cluster/calcium/calcium.go | 2 +- core.go | 46 ++++++++++++++++------------- go.mod | 14 ++------- go.sum | 55 +++++++++++++--------------------- app.yaml => spec.yaml | 0 types/config.go | 60 +++++++++++++++++++------------------- utils/config.go | 56 ++--------------------------------- utils/config_test.go | 6 ++-- utils/utils.go | 2 -- 13 files changed, 89 insertions(+), 179 deletions(-) delete mode 100644 Dockerfile.debian rename app.yaml => spec.yaml (100%) diff --git a/.gitignore b/.gitignore index e5665633c..c9e182849 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ core -dev.yaml +dev*.yaml eru-core core.yaml core.yml diff --git a/Dockerfile b/Dockerfile index cc1ab5a30..d609df30a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM golang:alpine AS BUILD # make binary -RUN apk add --no-cache build-base musl-dev libgit2-dev git curl make cmake python\ - && go get -d github.com/projecteru2/core +RUN apk add --no-cache build-base musl-dev libgit2-dev git curl make cmake python +RUN git clone https://github.com/projecteru2/core.git /go/src/github.com/projecteru2/core WORKDIR /go/src/github.com/projecteru2/core RUN make build && ./eru-core --version diff --git a/Dockerfile.debian b/Dockerfile.debian deleted file mode 100644 index 118c1da43..000000000 --- a/Dockerfile.debian +++ /dev/null @@ -1,19 +0,0 @@ -FROM debian:sid-slim AS BUILD - -RUN apt update \ - && apt install -y golang-1.13 git libgit2-dev make \ - && git clone https://github.com/projecteru2/core.git -WORKDIR /core -RUN export PATH=/usr/lib/go-1.13/bin:$PATH \ - && make build \ - && ./eru-core --version - -FROM debian:sid-slim - -RUN mkdir /etc/eru/ -LABEL ERU=1 -RUN apt update \ - && apt install -y libgit2-27 libssh2-1 \ - && rm -rf /var/lib/apt/lists/* -COPY --from=BUILD /core/eru-core /usr/bin/eru-core -COPY --from=BUILD /core/core.yaml.sample /etc/eru/core.yaml.sample diff --git a/VERSION b/VERSION index 62d47272b..f4577e48f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -19.09.30 +19.10.01 diff --git a/cluster/calcium/calcium.go b/cluster/calcium/calcium.go index b09dac34c..591425863 100644 --- a/cluster/calcium/calcium.go +++ b/cluster/calcium/calcium.go @@ -46,7 +46,7 @@ func New(config types.Config, embededStorage bool) (*Calcium, error) { case cluster.Github: scm = github.New(config) default: - log.Warn("[Calcium] SCM not set, build API disable") + log.Warn("[Calcium] SCM not set, build API disabled") } return &Calcium{store: store, config: config, scheduler: scheduler, source: scm}, nil diff --git a/core.go b/core.go index 2d3d01ebf..b3b92e8e8 100644 --- a/core.go +++ b/core.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "net" "net/http" _ "net/http/pprof" @@ -17,7 +18,7 @@ import ( "github.com/projecteru2/core/versioninfo" "github.com/prometheus/client_golang/prometheus/promhttp" log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" + cli "github.com/urfave/cli/v2" "google.golang.org/grpc" ) @@ -42,20 +43,12 @@ func setupLog(l string) error { } func serve() { - if configPath == "" { - log.Fatal("[main] Config path must be set") - } - config, err := utils.LoadConfig(configPath) if err != nil { log.Fatalf("[main] %v", err) } - logLevel := "INFO" - if config.LogLevel != "" { - logLevel = config.LogLevel - } - if err := setupLog(logLevel); err != nil { + if err := setupLog(config.LogLevel); err != nil { log.Fatalf("[main] %v", err) } @@ -114,19 +107,32 @@ func serve() { } func main() { - cli := &cobra.Command{ - Use: versioninfo.NAME, - Short: versioninfo.NAME, - Long: versioninfo.NAME, - Version: versioninfo.VersionString(), + cli.VersionPrinter = func(c *cli.Context) { + fmt.Print(versioninfo.VersionString()) } - cli.Flags().StringVarP(&configPath, "config", "c", "/etc/eru/core.yaml", "config file path for core") - cli.Flags().BoolVarP(&embeddedStorage, "embeded-storage", "e", false, "active embedded storage") - - cli.Run = func(cmd *cobra.Command, args []string) { + app := cli.NewApp() + app.Name = versioninfo.NAME + app.Usage = "Run eru core" + app.Version = versioninfo.VERSION + app.Flags = []cli.Flag{ + &cli.StringFlag{ + Name: "config", + Value: "/etc/eru/core.yaml", + Usage: "config file path for core, in yaml", + Destination: &configPath, + EnvVars: []string{"ERU_CONFIG_PATH"}, + }, + &cli.BoolFlag{ + Name: "embedded-storage", + Usage: "active embedded storage", + Destination: &embeddedStorage, + }, + } + app.Action = func(c *cli.Context) error { serve() + return nil } - cli.Execute() + app.Run(os.Args) } diff --git a/go.mod b/go.mod index 4fff56616..f0d272e81 100644 --- a/go.mod +++ b/go.mod @@ -11,9 +11,9 @@ require ( github.com/containerd/continuity v0.0.0-20180612233548-246e49050efd // indirect github.com/coreos/bbolt v1.3.1-coreos.6 // indirect github.com/coreos/etcd v3.3.13+incompatible + github.com/coreos/go-semver v0.2.0 // indirect github.com/coreos/go-systemd v0.0.0-20170731111925-d21964639418 // indirect github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf // indirect - github.com/creack/pty v1.1.9 // indirect github.com/dgrijalva/jwt-go v3.0.0+incompatible // indirect github.com/docker/distribution v0.0.0-20171207180435-f4118485915a github.com/docker/docker v0.0.0-20181112142024-a5e2dd2bb141 @@ -21,7 +21,6 @@ require ( github.com/docker/go-units v0.3.3 github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-check/check v0.0.0-20180628173108-788fd7840127 // indirect github.com/golang/protobuf v1.3.2 github.com/gorilla/context v1.1.1 // indirect github.com/gorilla/mux v0.0.0-20180605211556-cb4698366aa6 // indirect @@ -29,41 +28,34 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20181112102510-3304cc886352 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20170826090648-0dafe0d496ea // indirect github.com/grpc-ecosystem/grpc-gateway v1.3.0 // indirect + github.com/jinzhu/configor v1.1.1 github.com/jonboulle/clockwork v0.1.0 // indirect github.com/json-iterator/go v1.1.6 // indirect github.com/libgit2/git2go v0.0.0-20190813182810-37e5b53f742d - github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.1 // indirect github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v0.0.0-20180411145040-e562b0440392 // indirect github.com/opencontainers/runc v0.0.0-20180615140650-ad0f5255060d // indirect github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/philhofer/fwd v1.0.0 // indirect - github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7 // indirect github.com/projecteru2/libyavirt v0.0.0-20190927033610-01b2baa9a637 github.com/prometheus/client_golang v0.9.3 github.com/sanity-io/litter v1.1.0 github.com/sirupsen/logrus v1.4.2 github.com/soheilhy/cmux v0.1.3 // indirect - github.com/spf13/cobra v0.0.5 github.com/stretchr/testify v1.3.0 - github.com/tinylib/msgp v1.1.0 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 // indirect + github.com/urfave/cli/v2 v2.0.0-alpha.2 github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect go.uber.org/atomic v1.3.2 // indirect go.uber.org/multierr v1.1.0 // indirect go.uber.org/zap v1.7.1 // indirect golang.org/x/crypto v0.0.0-20190926180335-cea2066c6411 // indirect - golang.org/x/exp v0.0.0-20190925190815-26a69ce95baf // indirect golang.org/x/net v0.0.0-20190926025831-c00fd9afed17 golang.org/x/sys v0.0.0-20190926180325-855e68c8590b // indirect - golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd // indirect - google.golang.org/appengine v1.6.4 // indirect google.golang.org/genproto v0.0.0-20190926190326-7ee9db18f195 // indirect google.golang.org/grpc v1.24.0 gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect - gopkg.in/yaml.v2 v2.2.2 gotest.tools v2.2.0+incompatible // indirect ) diff --git a/go.sum b/go.sum index 468d14acc..e74d99fa6 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,7 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CMGS/git2go v0.0.0-20190930074211-b81086e21275 h1:miyqnYtxgDU9D4SoS/6IrTq5aD6cJE4KYtNHH1odG64= @@ -24,8 +25,8 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alexcesaro/statsd v2.0.0+incompatible h1:HG17k1Qk8V1F4UOoq6tx+IUoAbOcI5PHzzEUGeDD72w= github.com/alexcesaro/statsd v2.0.0+incompatible/go.mod h1:vNepIbQAiyLe1j480173M6NYYaAsGwEcvuDTU3OCUGY= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -35,19 +36,17 @@ github.com/containerd/continuity v0.0.0-20180612233548-246e49050efd h1:AqPnRJG7B github.com/containerd/continuity v0.0.0-20180612233548-246e49050efd/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/coreos/bbolt v1.3.1-coreos.6 h1:uTXKg9gY70s9jMAKdfljFQcuh4e/BXOM+V+d00KFj3A= github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20170731111925-d21964639418 h1:0QH6fTJVDpblGjjozilaO++YRbnQNnTYh3yuFJHH0o8= github.com/coreos/go-systemd v0.0.0-20170731111925-d21964639418/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf h1:CAKfRE2YtTUIjjh1bkBtyYFaUT/WmOqsJjgtihT0vMI= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -62,11 +61,10 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -74,6 +72,7 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -89,6 +88,7 @@ github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -112,9 +112,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpg github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jinzhu/configor v1.1.1 h1:gntDP+ffGhs7aJ0u8JvjCDts2OsxsI7bnz3q+jC+hSY= +github.com/jinzhu/configor v1.1.1/go.mod h1:nX89/MOmDba7ZX7GCyU/VIaQ2Ar2aizBl2d3JLF/rDc= github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= @@ -125,16 +124,14 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= @@ -149,13 +146,10 @@ github.com/opencontainers/runc v0.0.0-20180615140650-ad0f5255060d h1:xR1OjwB9B/l github.com/opencontainers/runc v0.0.0-20180615140650-ad0f5255060d/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= github.com/projecteru2/libyavirt v0.0.0-20190927033610-01b2baa9a637 h1:vizWMkj2UiX7wD7aUINTXbHeEbiYRX1h2l+cRJ9qHGI= github.com/projecteru2/libyavirt v0.0.0-20190927033610-01b2baa9a637/go.mod h1:hLHHuglFKcVGlCrmqPMFVMS6N3A4WCjyXSGktxnba8M= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -173,36 +167,30 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sanity-io/litter v1.1.0 h1:BllcKWa3VbZmOZbDCoszYLk7zCsKHz5Beossi8SUcTc= github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/soheilhy/cmux v0.1.3 h1:09wy7WZk4AqO03yH85Ex1X+Uo3vDsil3Fa9AgF8Emss= github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli/v2 v2.0.0-alpha.2 h1:2OVOKijPPhkA1cJA5SABACE8TT3Cwx9T0N6VtI8LJSI= +github.com/urfave/cli/v2 v2.0.0-alpha.2/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= @@ -213,7 +201,6 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/ go.uber.org/zap v1.7.1 h1:wKPciimwkIgV4Aag/wpSDzvtO5JrfwdHKHO7blTHx7Q= go.uber.org/zap v1.7.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -226,7 +213,6 @@ golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxT golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20190919035709-81c71964d733/go.mod h1:lopKMxgphN5jWNwrkPRQU99WV/Hs5LrdgRBxZ5ELgOQ= -golang.org/x/exp v0.0.0-20190925190815-26a69ce95baf/go.mod h1:/XYaSSBNneWTe8VNa9AjSawUDfGmbpmIqqzQT33BSc0= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -268,7 +254,6 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -305,8 +290,6 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190909214602-067311248421/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190925020647-22afafe3322a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190925164712-ae58c0ff6b32/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -318,7 +301,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.3/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.4/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -337,14 +319,17 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVCwMc= gopkg.in/alexcesaro/statsd.v2 v2.0.0/go.mod h1:i0ubccKGzBVNBpdGV5MocxyA/XlLUJzA7SLonnE4drU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/app.yaml b/spec.yaml similarity index 100% rename from app.yaml rename to spec.yaml diff --git a/types/config.go b/types/config.go index 3cb62fc96..2182d262d 100644 --- a/types/config.go +++ b/types/config.go @@ -6,14 +6,14 @@ import ( // Config holds eru-core config type Config struct { - LogLevel string `yaml:"log_level"` - Bind string `yaml:"bind"` // HTTP API address - Statsd string `yaml:"statsd"` // statsd host and port - Profile string `yaml:"profile"` // profile ip:port - LockTimeout int `yaml:"lock_timeout"` // timeout for lock (ttl) - GlobalTimeout time.Duration `yaml:"global_timeout"` // timeout for remove, run_and_wait and build, in second - Auth AuthConfig `yaml:"auth"` // grpc auth - GRPCConfig GRPCConfig `yaml:"grpc"` // grpc config + LogLevel string `yaml:"log_level" required:"true" default:"INFO"` + Bind string `yaml:"bind" required:"true" default:"5001"` // HTTP API address + LockTimeout int `yaml:"lock_timeout" required:"true" default:"30"` // timeout for lock (ttl) + GlobalTimeout time.Duration `yaml:"global_timeout" required:"true" default:"300s"` // timeout for remove, run_and_wait and build, in second + Statsd string `yaml:"statsd"` // statsd host and port + Profile string `yaml:"profile"` // profile ip:port + Auth AuthConfig `yaml:"auth"` // grpc auth + GRPCConfig GRPCConfig `yaml:"grpc"` // grpc config Git GitConfig `yaml:"git"` Etcd EtcdConfig `yaml:"etcd"` @@ -24,13 +24,13 @@ type Config struct { // EtcdConfig holds eru-core etcd config type EtcdConfig struct { - Machines []string `yaml:"machines"` // etcd cluster addresses - Prefix string `yaml:"prefix"` // etcd lock prefix, all locks will be created under this dir - LockPrefix string `yaml:"lock_prefix"` // etcd lock prefix, all locks will be created under this dir - Ca string `yaml:"ca"` // etcd ca - Key string `yaml:"key"` // etcd key - Cert string `yaml:"cert"` // etcd trusted_ca - Auth AuthConfig `yaml:"auth"` // etcd auth + Machines []string `yaml:"machines" required:"true"` // etcd cluster addresses + Prefix string `yaml:"prefix" required:"true" default:"/eru"` // etcd lock prefix, all locks will be created under this dir + LockPrefix string `yaml:"lock_prefix" required:"true" default:"__lock__/eru"` // etcd lock prefix, all locks will be created under this dir + Ca string `yaml:"ca"` // etcd ca + Key string `yaml:"key"` // etcd key + Cert string `yaml:"cert"` // etcd trusted_ca + Auth AuthConfig `yaml:"auth"` // etcd auth } // GitConfig holds eru-core git config @@ -43,15 +43,15 @@ type GitConfig struct { // DockerConfig holds eru-core docker config type DockerConfig struct { - APIVersion string `yaml:"version"` // docker API version - NetworkMode string `yaml:"network_mode"` // docker network mode - CertPath string `yaml:"cert_path"` // docker cert files path - Hub string `yaml:"hub"` // docker hub address - Namespace string `yaml:"namespace"` // docker hub prefix, will be set to $Hub/$HubPrefix/$appname - BuildPod string `yaml:"build_pod"` // podname used to build - UseLocalDNS bool `yaml:"local_dns"` // use node IP as dns - Log LogConfig `yaml:"log"` // docker log driver - AuthConfigs map[string]AuthConfig `yaml:"auths"` // docker registry credentials + APIVersion string `yaml:"version" required:"true" default:"1.32"` // docker API version + NetworkMode string `yaml:"network_mode" required:"true" default:"host"` // docker network mode + CertPath string `yaml:"cert_path" required:"true" default:"/tmp"` // docker cert files path + Hub string `yaml:"hub"` // docker hub address + Namespace string `yaml:"namespace"` // docker hub prefix, will be set to $Hub/$HubPrefix/$appname + BuildPod string `yaml:"build_pod"` // podname used to build + UseLocalDNS bool `yaml:"local_dns"` // use node IP as dns + Log LogConfig `yaml:"log"` // docker log driver + AuthConfigs map[string]AuthConfig `yaml:"auths"` // docker registry credentials } // VirtConfig holds yavirtd config @@ -61,14 +61,14 @@ type VirtConfig struct { // LogConfig define log type type LogConfig struct { - Type string `yaml:"type"` // Log type, can be "journald", "json-file", "none" - Config map[string]string `yaml:"config"` // Log configs + Type string `yaml:"type" required:"true" default:"journald"` // Log type, can be "journald", "json-file", "none" + Config map[string]string `yaml:"config"` // Log configs } // SchedConfig holds scheduler config type SchedConfig struct { - MaxShare int `yaml:"maxshare"` // comlpex scheduler use maxshare - ShareBase int `yaml:"sharebase"` // how many pieces for one core + MaxShare int `yaml:"maxshare" required:"true" default:"-1"` // comlpex scheduler use maxshare + ShareBase int `yaml:"sharebase" required:"true" default:"100"` // how many pieces for one core } // AuthConfig contains authorization information for connecting to a Registry @@ -82,6 +82,6 @@ type AuthConfig struct { // GRPCConfig indicate grpc config type GRPCConfig struct { - MaxConcurrentStreams int `yaml:"max_concurrent_streams,omitempty" json:"max_concurrent_streams,omitempty"` - MaxRecvMsgSize int `yaml:"max_recv_msg_size,omitempty" json:"max_recv_msg_size,omitempty"` + MaxConcurrentStreams int `yaml:"max_concurrent_streams,omitempty" json:"max_concurrent_streams,omitempty" required:"true" default:"100"` + MaxRecvMsgSize int `yaml:"max_recv_msg_size,omitempty" json:"max_recv_msg_size,omitempty" required:"true" default:"20971520"` } diff --git a/utils/config.go b/utils/config.go index f878268ac..ee64af97a 100644 --- a/utils/config.go +++ b/utils/config.go @@ -1,66 +1,14 @@ package utils import ( - "io/ioutil" - "time" - "github.com/projecteru2/core/types" - "github.com/docker/go-units" - log "github.com/sirupsen/logrus" - yaml "gopkg.in/yaml.v2" -) - -const ( - defaultTTL = 30 - defaultPrefix = "/eru" + "github.com/jinzhu/configor" ) // LoadConfig load config from yaml func LoadConfig(configPath string) (types.Config, error) { config := types.Config{} - bytes, err := ioutil.ReadFile(configPath) - if err != nil { - return config, err - } - - if err := yaml.Unmarshal(bytes, &config); err != nil { - return config, err - } - - if config.LockTimeout == 0 { - config.LockTimeout = defaultTTL - } - - if config.GlobalTimeout == 0 { - log.Fatal("[Config] Global timeout invaild, exit") - } - config.GlobalTimeout = config.GlobalTimeout * time.Second - - if config.Etcd.Prefix == "" { - config.Etcd.Prefix = defaultPrefix - } - - if config.Docker.APIVersion == "" { - config.Docker.APIVersion = "1.32" - } - // 默认是 journald - if config.Docker.Log.Type == "" { - config.Docker.Log.Type = Journald - } - if config.Scheduler.ShareBase == 0 { - config.Scheduler.ShareBase = 100 - } - if config.Scheduler.MaxShare == 0 { - config.Scheduler.MaxShare = -1 - } - if config.GRPCConfig.MaxConcurrentStreams == 0 { - config.GRPCConfig.MaxConcurrentStreams = 100 - } - if config.GRPCConfig.MaxRecvMsgSize == 0 { - config.GRPCConfig.MaxRecvMsgSize = 20 * units.MiB - } - - return config, nil + return config, configor.Load(&config, configPath) } diff --git a/utils/config_test.go b/utils/config_test.go index 35377e5b8..3322b2769 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -23,7 +23,7 @@ func TestLoadConfig(t *testing.T) { bind: ":5001" statsd: "127.0.0.1:8125" profile: ":12346" -global_timeout: 300 +global_timeout: 300s auth: username: admin @@ -51,9 +51,9 @@ docker: assert.NoError(t, err) config, err := LoadConfig(fname) assert.NoError(t, err) - assert.Equal(t, config.LockTimeout, defaultTTL) + assert.Equal(t, config.LockTimeout, 30) assert.Equal(t, config.GlobalTimeout, time.Duration(time.Second*300)) - assert.Equal(t, config.Etcd.Prefix, defaultPrefix) + assert.Equal(t, config.Etcd.Prefix, "/eru") assert.Equal(t, config.Docker.Log.Type, "journald") assert.Equal(t, config.Docker.APIVersion, "1.32") assert.Equal(t, config.Scheduler.MaxShare, -1) diff --git a/utils/utils.go b/utils/utils.go index d7de2d186..782b5ec1e 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -27,8 +27,6 @@ const ( DefaultVersion = "latest" // WrongVersion for wrong version WrongVersion = "unknown" - // Journald log - Journald = "journald" ) // RandomString random a string