diff --git a/cmd/idata/main.go b/cmd/idata/main.go index fdc30c5..8ac2054 100644 --- a/cmd/idata/main.go +++ b/cmd/idata/main.go @@ -20,6 +20,7 @@ import ( "github.com/jageros/hawox/mysql" "github.com/jageros/hawox/redis" "idata/internal/api" + "idata/internal/conf" "idata/internal/service/dirty" "idata/internal/service/soup" "idata/internal/service/user" @@ -27,62 +28,53 @@ import ( "time" ) -const appName = "idata" +const ( + appName = "idata" +) func main() { rand.Seed(time.Now().UnixNano()) - ctx, wait := flags.Parse(appName) + ctx, wait := flags.Parse(appName, func(opt *flags.Option) { + opt.Keys = conf.Keys + }) defer wait() - soupPath := flags.GetValStr("soup.path") - if soupPath == "" { - soupPath = "soup.txt" - } - - datePath := flags.GetValStr("date.path") - if datePath == "" { - datePath = "date.json" - } - - dictPath := flags.GetValStr("dict.path") - if dictPath == "" { - dictPath = "dict.txt" - } + conf.ParseFromFlags() - err := astro.InitFromJsonFile(datePath) + err := astro.InitFromJsonFile(conf.DatePath) if err != nil { logx.Fatalf("astro init err: %v", err) } - err = soup.InitFromFile(soupPath) + err = soup.InitFromFile(conf.SoupPath) if err != nil { logx.Fatalf("soup init err:%v", err) } - err = dirty.InitDirtyWord(dictPath) + err = dirty.InitDirtyWord(conf.DictPath) if err != nil { logx.Fatalf("dirty init err:%v", err) } redis.Initialize(ctx, func(rdb redis.RdbConfig) { - rdb.SetAddrs(flags.Options.RedisAddrs) - rdb.SetUsername(flags.Options.RedisUser) - rdb.SetPassword(flags.Options.RedisPasswd) - rdb.SetDB(flags.Options.RedisDBNo) + rdb.SetAddrs(conf.RedisAddrs) + rdb.SetUsername(conf.RedisUser) + rdb.SetPassword(conf.RedisPassword) + rdb.SetDB(conf.RedisDBNo) }) mysql.Initialize(func(opt *mysql.Option) { - opt.Addr = flags.Options.MysqlAddr - opt.Username = flags.Options.MysqlUser - opt.Password = flags.Options.MysqlPwd - opt.Database = flags.Options.MysqlDB + opt.Addr = conf.MysqlAddr + opt.Username = conf.MysqlUser + opt.Password = conf.MysqlPwd + opt.Database = conf.MysqlDB }) user.InitDao(mysql.ConnWithCache()) httpx.InitializeHttpServer(ctx, api.Registry, func(s *httpx.Server) { s.Mode = flags.Options.Mode - s.ListenIp = flags.Options.HttpIp - s.Port = flags.Options.HttpPort + s.ListenIp = conf.ListenIP + s.Port = conf.ListenPort }) } diff --git a/conf.d/config.yaml b/conf.d/config.yaml index 965fd4a..b60bcc3 100644 --- a/conf.d/config.yaml +++ b/conf.d/config.yaml @@ -26,7 +26,7 @@ mysql: redis: - addrs: "127.0.0.1:7001;127.0.0.1:7002;127.0.0.1:7003;127.0.0.1:7004;127.0.0.1:7005;127.0.0.1:7006" + addrs: "119.29.105.154:9736" db: 0 # user: "redis-user" # password: "redis-passwd" diff --git a/go.mod b/go.mod index ce8866b..d672779 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,14 @@ go 1.17 require ( github.com/gin-gonic/gin v1.7.7 - github.com/jageros/hawox v0.1.8 + github.com/jageros/hawox v0.2.7 github.com/tal-tech/go-zero v1.2.1 ) require ( github.com/cespare/xxhash/v2 v2.1.1 // indirect - github.com/coreos/go-semver v0.3.0 // indirect - github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/eapache/queue v1.1.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gin-contrib/cors v1.3.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect @@ -25,7 +22,6 @@ require ( github.com/go-redis/redis/v8 v8.11.0 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/go-xorm/builder v0.3.4 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -48,10 +44,6 @@ require ( github.com/spf13/viper v1.8.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/ugorji/go/codec v1.1.7 // indirect - github.com/xiaonanln/go-xnsyncutil v0.0.5 // indirect - go.etcd.io/etcd/api/v3 v3.5.0 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect - go.etcd.io/etcd/client/v3 v3.5.0 // indirect go.opentelemetry.io/otel v1.0.0-RC2 // indirect go.opentelemetry.io/otel/trace v1.0.0-RC2 // indirect go.uber.org/atomic v1.7.0 // indirect @@ -59,17 +51,12 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.0 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/net v0.0.0-20210716203947-853a461950ff // indirect golang.org/x/sys v0.0.0-20210820121016-41cdb8703e55 // indirect golang.org/x/text v0.3.6 // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect - google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f // indirect - google.golang.org/grpc v1.39.0 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/eapache/queue.v1 v1.1.0 // indirect gopkg.in/ini.v1 v1.62.0 // indirect - gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index d619f56..89f91c4 100644 --- a/go.sum +++ b/go.sum @@ -115,9 +115,7 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -134,7 +132,6 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= @@ -213,7 +210,6 @@ github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:9wScpmSP5A3Bk github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -322,8 +318,8 @@ github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5N github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/jageros/hawox v0.1.8 h1:4LpBuKEeYs4q3KstPJrOUWuiLT9X1e3HTApE0S3+/fg= -github.com/jageros/hawox v0.1.8/go.mod h1:SmP4sI64uIP4Cg8CwU1///5Gii2z0jcn+BHi9ajnyyg= +github.com/jageros/hawox v0.2.7 h1:RvCy3E3ORPs+Mc5XlS+6UpuoM1comDkwamZpacfO4tg= +github.com/jageros/hawox v0.2.7/go.mod h1:SmP4sI64uIP4Cg8CwU1///5Gii2z0jcn+BHi9ajnyyg= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= @@ -513,7 +509,6 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xiaonanln/go-xnsyncutil v0.0.5 h1:1kan2cg95e0quhKEBafu1lNG3UVI44BF0ThlJGa+lJQ= github.com/xiaonanln/go-xnsyncutil v0.0.5/go.mod h1:PbwFumxH1s5Zc5mPk3A9GFaS/FdIP5WHobaRwQLS8xY= github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0= @@ -527,12 +522,9 @@ github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M= github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348/go.mod h1:ISU/8NuPyEpl9pa17Py9TBPetMjtsiHrb9f5XGiYbo8= -go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v3 v3.5.0 h1:62Eh0XOro+rDwkrypAGDfgmNh5Joq+z+W9HZdlXMzek= go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -892,7 +884,6 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f h1:YORWxaStkWBnWgELOHTmDrqNlFXuVGEbhwbB5iK94bQ= google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -914,7 +905,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0 h1:Klz8I9kdtkIN6EpHHUOMLCYhTn/2WAe5a0s1hcBkdTI= google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -938,7 +928,6 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/eapache/queue.v1 v1.1.0 h1:EldqoJEGtXYiVCMRo2C9mePO2UUGnYn2+qLmlQSqPdc= gopkg.in/eapache/queue.v1 v1.1.0/go.mod h1:wNtmx1/O7kZSR9zNT1TTOJ7GLpm3Vn7srzlfylFbQwU= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -950,7 +939,6 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= diff --git a/internal/conf/conf.go b/internal/conf/conf.go new file mode 100644 index 0000000..a481a7f --- /dev/null +++ b/internal/conf/conf.go @@ -0,0 +1,84 @@ +/** + * @Author: jager + * @Email: lhj168os@gmail.com + * @File: conf + * @Date: 2022/2/9 6:01 下午 + * @package: conf + * @Version: v1.0.0 + * + * @Description: + * + */ + +package conf + +import "github.com/jageros/hawox/flags" + +const ( + keySoupPath = "soup.path" + keyDatePath = "date.path" + keyDictPath = "dict.path" + keyMysqlAddr = "mysql.addr" + keyMysqlUser = "mysql.user" + keyMysqlPwd = "mysql.password" + keyMysqlDB = "mysql.database" + keyRedisAddrs = "redis.addrs" + keyRedisUser = "redis.user" + keyRedisPwd = "redis.password" + keyRedisDB = "redis.db" + keyListenIP = "listen.ip" + keyListenPort = "listen.port" +) + +var ( + SoupPath = "conf.d/soup.txt" + DatePath = "conf.d/date.json" + DictPath = "conf.d/dict.txt" + + MysqlAddr = "127.0.0.1:3306" + MysqlUser = "root" + MysqlPwd = "QianYin@66" + MysqlDB = "hawox" + + RedisAddrs = "127.0.0.1:6379" + RedisUser = "" + RedisPassword = "" + RedisDBNo = 0 + + ListenIP = "" + ListenPort = 8001 +) + +var ( + Keys = map[string]*flags.ValInfo{ + keySoupPath: {Val: SoupPath, Description: "soup path"}, + keyDatePath: {Val: DatePath, Description: "date json path"}, + keyDictPath: {Val: DictPath, Description: "dirty word txt path"}, + keyMysqlAddr: {Val: MysqlAddr, Description: "mysql addr"}, + keyMysqlUser: {Val: MysqlUser, Description: "mysql user"}, + keyMysqlPwd: {Val: MysqlPwd, Description: "mysql password"}, + keyMysqlDB: {Val: MysqlDB, Description: "mysql database"}, + keyRedisAddrs: {Val: RedisAddrs, Description: "redis addrs"}, + keyRedisUser: {Val: RedisUser, Description: "redis user"}, + keyRedisPwd: {Val: RedisPassword, Description: "redis password"}, + keyRedisDB: {Val: RedisDBNo, Description: "redis db No"}, + keyListenIP: {Val: ListenIP, Description: "listen ip"}, + keyListenPort: {Val: ListenPort, Description: "listen port"}, + } +) + +func ParseFromFlags() { + SoupPath = flags.GetString(keySoupPath) + DatePath = flags.GetString(keyDatePath) + DictPath = flags.GetString(keyDictPath) + MysqlAddr = flags.GetString(keyMysqlAddr) + MysqlUser = flags.GetString(keyMysqlUser) + MysqlPwd = flags.GetString(keyMysqlPwd) + MysqlDB = flags.GetString(keyMysqlDB) + RedisAddrs = flags.GetString(keyRedisAddrs) + RedisUser = flags.GetString(keyRedisUser) + RedisPassword = flags.GetString(keyRedisPwd) + RedisDBNo = flags.GetInt(keyRedisDB) + ListenIP = flags.GetString(keyListenIP) + ListenPort = flags.GetInt(keyListenPort) +}