Prerequisites
go version go1.19
or higherbuild-esential
To run this app please take a look for required environment variable
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Export GO bin:
export PATH="$PATH:$(go env GOPATH)/bin"
Generate proto:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
services/grpc/hello/hello.proto
Note: Make sure you have 'make' command installed
Run Project
make run
Run Test
make test
Build executable binary
make build
Build docker image version
make build-image
Run docker image version
make run-image
Notes:
When running, this app will looking for .env if not found it will take host variable instead.
Other than that, you also can get the configs from vault. See the environment variable
Required:
ENV
App Environment, Eg: development, staging, productionPORT
App portDB_HOST
Db HostDB_PORT
Db portDB_USER
Db userDB_PASS
Db PassDB_NAME
Db nameDB_MAX_OPEN_CONN
Db max open connectionDB_MAX_IDLE_CONN
Db max idle connectionDB_MAX_LIFE_TIME
Db max life timeJWT_SECRET_KEY
JWT secret key
Redis:
REDIS_ENABLED
(true|false) to enable or disable redis connectionREDIS_HOST
Redis hostREDIS_PORT
Redis portREDIS_USER
Redis userREDIS_PASS
Redis password
Vault:
VAULT_ENABLED
(true|false) to enable or disable to get configs from vaultVAULT_ADDRESS
Vault addressVAULT_TOKEN
Vault tokenVAULT_SERVICE_NAME
Vault service nameVAULT_SECRET_NAME
Vault secret name
No rules for now. Feel free to add issue first and optionally submit a PR. Cheers