加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
Blademainer 提交于 2019-05-12 21:56 . init
package main
import (
"flag"
"github.com/pjoc-team/base-service/pkg/service"
"github.com/pjoc-team/channel-isppay/pkg/channel"
)
var (
listenAddr = flag.String("listen-addr", ":8084", "HTTP listen address.")
configURI = flag.String("c", "config.yaml", "uri to load config")
tlsEnable = flag.Bool("tls", false, "enable tls")
logLevel = flag.String("log-level", "debug", "logger level")
logFormat = flag.String("log-format", "text", "text or json")
caCert = flag.String("ca-cert", service.WithConfigDir("ca.pem"), "Trusted CA certificate.")
tlsCert = flag.String("tls-cert", service.WithConfigDir("cert.pem"), "TLS server certificate.")
tlsKey = flag.String("tls-key", service.WithConfigDir("key.pem"), "TLS server key.")
serviceName = flag.String("s", "", "PayGatewayService name in service discovery.")
registerServiceToEtcd = flag.Bool("r", true, "Register service to etcd.")
etcdPeers = flag.String("etcd-peers", "", "Etcd peers. example: 127.0.0.1:2379,127.0.0.1:12379")
)
func main() {
flag.Parse()
//serviceDir := gateway.ETCD_DIR_ROOT + "/services"
svc := service.InitService(*listenAddr,
*configURI,
*tlsEnable,
*logLevel,
*logFormat,
*caCert,
*tlsCert,
*tlsKey,
*serviceName,
*registerServiceToEtcd,
*etcdPeers,
"")
channel.Init(svc)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化