add: generate scripts

This commit is contained in:
viletyy 2021-06-20 22:28:27 +08:00
parent f317b9ecb7
commit 3918c6726b
3 changed files with 46 additions and 0 deletions

28
initialize/http_server.go Normal file
View File

@ -0,0 +1,28 @@
/*
* @Date: 2021-03-22 17:03:27
* @LastEditors: viletyy
* @LastEditTime: 2021-06-20 22:22:10
* @FilePath: /potato/initialize/http_server.go
*/
package initialize
import (
"net/http"
"time"
"github.com/viletyy/potato/global"
"github.com/viletyy/potato/internal/routers"
)
func RunHttpServer(port string) *http.Server {
router := routers.InitRouter()
server := &http.Server{
Addr: port,
Handler: router,
ReadTimeout: time.Duration(global.GO_CONFIG.Server.ReadTimeout) * time.Second,
WriteTimeout: time.Duration(global.GO_CONFIG.Server.ReadTimeout) * time.Second,
MaxHeaderBytes: 1 << 20,
}
return server
}

View File

@ -0,0 +1,9 @@
###
# @Date: 2021-06-20 21:43:20
# @LastEditors: viletyy
# @LastEditTime: 2021-06-20 22:24:50
# @FilePath: /potato/scripts/gen_basic_proto.sh
###
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
./proto/basic/*.proto

9
scripts/gen_proto.sh Normal file
View File

@ -0,0 +1,9 @@
###
# @Date: 2021-06-20 21:43:20
# @LastEditors: viletyy
# @LastEditTime: 2021-06-20 22:23:27
# @FilePath: /potato/scripts/gen_proto.sh
###
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
./proto/*.proto