Skip to content

Commit

Permalink
feat: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
daheige committed May 15, 2022
1 parent b41be51 commit 397dafe
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ctx_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package gmicro
// CtxKey ctx key type.
type CtxKey string

const(
const (
// XRequestID request_id
XRequestID CtxKey = "x-request-id"
XRequestID CtxKey = "x-request-id"

// GRPCClientIP grpc client_ip
GRPCClientIP CtxKey = "grpc_client_ip"
Expand Down
4 changes: 2 additions & 2 deletions docs/centos7-grpc-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@
建立软链接
$ sudo ln -s /usr/local/protobuf/bin/protoc /usr/bin/protoc
$ sudo chmod +x /usr/bin/protoc

# go protoc工具安装

执行如下命令
go get -u github.com/golang/protobuf/proto
go install github.com/golang/protobuf/protoc-gen-go@latest
go install google.golang.org/grpc@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest
go get -u github.com/go-playground/validator/v10
go install github.com/go-playground/validator/v10@latest
go install github.com/golang/mock/mockgen@latest
go install github.com/favadi/protoc-go-inject-tag@latest

Expand Down
5 changes: 2 additions & 3 deletions docs/grpc-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16.3
FROM golang:1.16.15

# build golang environment
ENV PROTOC_VER 3.15.6
Expand All @@ -8,14 +8,13 @@ RUN apt-get update && apt-get install -y apt-utils zip unzip;
RUN wget -q -P /tmp/temp/ https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-x86_64.zip && \
cd /usr && unzip /tmp/temp/protoc-${PROTOC_VER}-linux-x86_64.zip;


RUN go env -w GO111MODULE=on; go env -w GOPROXY=https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,direct;go env -w CGO_ENABLED=0 && \
go get -u github.com/golang/protobuf/proto && \
go install github.com/golang/protobuf/protoc-gen-go@latest && \
go install google.golang.org/grpc@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest && \
go get -u github.com/go-playground/validator/v10 && \
go install github.com/go-playground/validator/v10@latest && \
go install github.com/golang/mock/mockgen && \
go install github.com/favadi/protoc-go-inject-tag@latest
1 change: 1 addition & 0 deletions docs/nodejs-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

cd /usr/local/
sudo wget https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz
# 这里我用的是ubuntu操作系统,如果使用centos,请自行安装xz工具
sudo apt-get install xz-utils
sudo xz -d node-v12.16.2-linux-x64.tar.xz
sudo tar xvf node-v12.16.2-linux-x64.tar
Expand Down
1 change: 1 addition & 0 deletions example/bin/go-generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

root_dir=$(cd "$(dirname "$0")"; cd ..; pwd)

protoExec=$(which "protoc")
Expand Down
2 changes: 1 addition & 1 deletion example/bin/grpc_tools.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# go gRPC tools
go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
Expand Down
1 change: 1 addition & 0 deletions example/bin/nodejs-generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

root_dir=$(cd "$(dirname "$0")"; cd ..; pwd)

protoExec=$(which "protoc")
Expand Down
1 change: 1 addition & 0 deletions example/bin/php-generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

root_dir=$(cd "$(dirname "$0")"; cd ..; pwd)

protoExec=$(which "protoc")
Expand Down
3 changes: 2 additions & 1 deletion example/bin/php7.2-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash

#ubuntu php7.2 install
phpExec=`which php`
if [ ! -z $phpExec ]; then
Expand Down
8 changes: 5 additions & 3 deletions micro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import (
"google.golang.org/grpc"
)

var reverseProxyFunc HandlerFromEndpoint
var httpPort, grpcPort, sharePort int
var shutdownFunc func()
var (
reverseProxyFunc HandlerFromEndpoint
httpPort, grpcPort, sharePort int
shutdownFunc func()
)

func initConf() {
reverseProxyFunc = func(
Expand Down

0 comments on commit 397dafe

Please sign in to comment.