rookie-ninja / rk-boot Goto Github PK
View Code? Open in Web Editor NEWBuild microservice with rk-boot and let the team take over clean and tidy code.
Home Page: https://rkdev.info
License: Apache License 2.0
Build microservice with rk-boot and let the team take over clean and tidy code.
Home Page: https://rkdev.info
License: Apache License 2.0
Any plan to support orm entgo?
When rkBoot setup is required to run a unit test in go, the NewBoot() function should find boot.yaml by default.
Providing a different Path for every Test depending on the Test location is sub-optimal.
Also, when the boot.yaml has entries which are relative to boot.yaml, they should be also be found in a Unit Test without extra path requirements.
Describe the solution you'd like
NewBoot() function should find boot,yaml by default in the project dir .
Describe alternatives you've considered
I have used TestMain to call one Setup() function which starts rkBoot, but this must also look for the path to boot,yaml relative to the Setup function location (which cannot exist in main package as it causes cricular dependancies)
Additional context
Add any other context or screenshots about the feature request here.
https://stackoverflow.com/questions/23729790/how-can-i-do-test-setup-using-the-testing-package-in-go
Describe the bug
Config values in a ConfigEntry file cannot be overridden from env vars
To Reproduce
- name: db-config
locale: "*::*::*::*"
path: config/db.yaml
host: localhost
os.Setenv("host=anotherhost")
Expected behavior
rkentry.GlobalAppCtx.GetConfigEntry("db-config").GetViper().GetString("host")
should be equal "anotherhost"
Describe the bug
Swagger / Docs enabled in boot.yaml produces panic in rk-boot - Bootstrap
go/pkg/mod/github.com/rookie-ninja/rk-boot/[email protected]/boot.go:174
panic: no / before catch-all in path '/\sw*any'
To Reproduce
Steps to reproduce the behavior:
swag init -g api/main.go
go run .\api\main.go
see go.mod below...
Desktop (please complete the following information):
func main() {
boot := rkboot.NewBoot()
...
boot.Bootstrap(context.TODO())
boot.WaitForShutdownSig(context.TODO())
}
boot,yaml includes (extract):
gin:
Additional context
{"level":"ERROR","ts":"2022-11-23T09:56:32.916+0100","caller":"[email protected]/boot.go:257","msg":"Panic occured, shutting down... \ngoroutine 1 [running]:\nruntime/debug.Stack()\n\tC:/Program Files/Go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/rookie-ninja/rk-boot/v2.syncLog({0xc000620000, 0x24})\n\tC:/Users//go/pkg/mod/github.com/rookie-ninja/rk-boot/[email protected]/boot.go:249 +0x65\npanic({0x12034a0, 0xc000339280})\n\tC:/Program Files/Go/src/runtime/panic.go:838 +0x207\ngithub.com/gin-gonic/gin.(*node).insertChild(0x12e2840?, {0xc00039b532?, 0x0?}, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users/mcconig/go/pkg/mod/github.com/gin-gonic/[email protected]/tree.go:363 +0xb2e\ngithub.com/gin-gonic/gin.(*node).addRoute(0x1374618?, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/[email protected]/tree.go:252 +0xa39\ngithub.com/gin-gonic/gin.(*Engine).addRoute(0xc00008cea0, {0x1374618, 0x3}, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:331
+0x226\ngithub.com/gin-gonic/gin.(*RouterGroup).handle(0xc00008cea0, {0x1374618, 0x3}, {0xc00039b4f0?, 0xc00020cb10?}, {0xc0000068f0, 0x1, 0x68?})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/[email protected]/routergroup.go:88 +0x145\ngithub.com/gin-gonic/gin.(*RouterGroup).GET(...)\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/[email protected]/routergroup.go:116\ngithub.com/rookie-ninja/rk-gin/v2/boot.(*GinEntry).Bootstrap(0xc00062adc0, {0x1685d40, 0xc00020cb10})\n\tC:/Users/mcconig/go/pkg/mod/github.com/rookie-ninja/rk-gin/[email protected]/boot/gin_entry.go:387 +0x53f\ngithub.com/rookie-ninja/rk-boot/v2.(*Boot).Bootstrap(0xc0001aed20, {0x1685cd0, 0xc000036068})\n\tC:/Users/mcconig/go/pkg/mod/github.com/rookie-ninja/rk-boot/[email protected]/boot.go:174 +0x46e\nmain.main()\n\tC:/Users//repos/configcontrol-api-ssh/api/main.go:28 +0x575\n","eventId":"d1e0a1e6-3095-408a-9e1c-a19a2edfdb3c","RootCause":"no / before catch-all in path '/\sw\*any'"}
panic: no / before catch-all in path '/\sw*any' [recovered]
panic: no / before catch-all in path '/\sw*any'
go.mod:
go 1.18
require (
github.com/gin-gonic/gin v1.8.1
github.com/rookie-ninja/rk-boot/v2 v2.2.11
github.com/rookie-ninja/rk-db/mysql v1.2.12
github.com/rookie-ninja/rk-entry/v2 v2.2.11
github.com/rookie-ninja/rk-gin/v2 v2.2.14
github.com/swaggo/swag v1.8.7
gorm.io/gorm v1.24.1
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gin-contrib/pprof v1.3.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rookie-ninja/rk-logger v1.2.12 // indirect
github.com/rookie-ninja/rk-query v1.2.14 // indirect
github.com/rs/xid v1.3.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
go.opentelemetry.io/contrib v1.8.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Hello!
I am wondering if rk-boot supports integration with cobra (or maybe another tool for creating CLIs using Go) and correspondingly can accept config parameters via cli.
Thank you!
想加入微信群,但是二维码过期了
hello,
Describe the bug
curl -X 'GET' \
'https://localhost:8082/api/v1/greeter?name=1' \
-H 'accept: application/json'
{
"error": {
"code": 401,
"status": "Unauthorized",
"message": "missing authorization, provide one of bellow auth header:[X-API-Key]",
"details": [
{
"code": 16,
"status": "Unauthenticated",
"message": "[from-grpc] missing authorization, provide one of bellow auth header:[X-API-Key]"
}
]
}
}
rk-boot/v2 v2.1.2
rk-grpc/v2 v2.0.2
rk-entry/v2 v2.1.7
谢谢。
There doesn't appear to be any way to use a database driver in gRPC endpoints. You have to register endpoints prior to bootstrapping the program, but you cannot access the DB instance until after bootstrapping the program, meaning the DB instance is inaccessible until after setting up gRPC endpoints.
If there is a way I missed, or some kind of workaround, please let me know. Thanks!
Hello! I am wondering if rk-boot supports updating boot.yaml config on the fly.
It would be convenient in case we wanted to change the logging level of a component on the fly, for example.
It seems similar configuration tool Viper already has watching configs
Description
Cannot override boot config values for JWT Middleware from environment variables.
Steps to reproduce the behavior:
echo:
- name: greeter
port: 8080
enabled: true
middleware:
jwt:
enabled: false
asymmetric:
algorithm: ""
publicKey: ""
privateKey: ""
package main
import (
"context"
"fmt"
"github.com/labstack/echo/v4"
rkboot "github.com/rookie-ninja/rk-boot/v2"
rkecho "github.com/rookie-ninja/rk-echo/boot"
"github.com/rookie-ninja/rk-echo/middleware/context"
"net/http"
"os"
)
func main() {
// ideally this will be added by CI/CD pipeline I have added this as an example
_ = os.Setenv("RK_ECHO_0_MIDDLEWARE_JWT_ENABLED", "true")
_ = os.Setenv("RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_ALGORITHM", "ES256")
_ = os.Setenv("RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_PUBLICKEY", "xxxxx")
_ = os.Setenv("RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_PRIVATEKEY", "xxxxx")
// Create a new boot instance.
boot := rkboot.NewBoot()
// Register handler
echoEntry := rkecho.GetEchoEntry("greeter")
echoEntry.Echo.GET("/v1/greeter", Greeter)
// Bootstrap
boot.Bootstrap(context.TODO())
boot.WaitForShutdownSig(context.TODO())
}
func Greeter(ctx echo.Context) error {
// Get JWT token
rkechoctx.GetJwtToken(ctx)
return ctx.JSON(http.StatusOK, &GreeterResponse{
Message: fmt.Sprintf("Hello %s!", ctx.QueryParam("name")),
})
}
type GreeterResponse struct {
Message string
}
go run main.go
➜ test git:(HB-13764---Initial-VMS-Service-and-Auth) ✗ go run main.go
2022-09-21T12:09:50.429+1000 INFO entry/util.go:299 Found ENV to override, applying... {"env": ["RK_ECHO_0_MIDDLEWARE_JWT_ENABLED=true => echo[0].middleware.jwt.enabled=true", "RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_ALGORITHM=ES256 => echo[0].middleware.jwt.asymmetric.algorithm=ES256", "RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_PUBLICKEY=xxxxx => echo[0].middleware.jwt.asymmetric.publickey=xxxxx", "RK_ECHO_0_MIDDLEWARE_JWT_ASYMMETRIC_PRIVATEKEY=xxxxx => echo[0].middleware.jwt.asymmetric.privatekey=xxxxx"]}
2022-09-21T12:09:50.430+1000 INFO boot/echo_entry.go:682 Bootstrap EchoEntry {"eventId": "28f73547-7079-4fa1-a6e5-9483e761b44b", "entryName": "greeter", "entryType": "EchoEntry"}
------------------------------------------------------------------------
endTime=2022-09-21T12:09:50.430602+10:00
startTime=2022-09-21T12:09:50.430542+10:00
elapsedNano=59241
timezone=AEST
ids={"eventId":"28f73547-7079-4fa1-a6e5-9483e761b44b"}
app={"appName":"rk","appVersion":"local","entryName":"greeter","entryType":"EchoEntry"}
env={"arch":"amd64","domain":"*","hostname":"C02YX1MSLVCF","localIP":"10.131.145.133","os":"darwin"}
payloads={"echoPort":8080}
counters={}
pairs={}
timing={}
remoteAddr=localhost
operation=Bootstrap
resCode=OK
eventStatus=Ended
EOE
➜ auth git:(HB-13764---Initial-VMS-Service-and-Auth) ✗ curl -XGET -H 'Authorization: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjo0NzA2MSwidmFsaWRhdGVkIjp0cnVlfSwiY29tbW9uIjp7ImNsaWVudCI6MTQsImJ1aWxkaW5nIjoxNTIsInRlbmFudCI6ODIyfSwic2NvcGVzIjpbInVzZXIuYXBwLmFsbCJdLCJpc3MiOiJsb2NhbGhvc3QiLCJleHAiOjIyNjQ4NTUxNDF9.ywC-EiD-GCWPM3cEor5i0Jcmwb3-ASf8sUjJ2SdQy55MCr8s8fFO1Xm3itWLFQczU2toEdUZv96VcteU0eTBHA' 'http://localhost:8080/v1/greeter'
{"Message":"Hello !"}
Expected behavior
The above request should not validate passed to the handler as I have use the env to overide the boot variables.
Additional context
The reason we require this is because when deploying our micro-services using CI/CD pipeline the configurations will get injected during build as environment variables.
A new error template is needed which may match bellow reqquirments.
1: Provide multiple API error format to select by user in boot.yaml
2: Extendable by user
3: Custom error format should be injectable
Q1:我有使用 https://github.com/hibiken/asynq 這個套件, 將task 拆分, 造成中斷而無法使用jaeger將後續利用asynq 的task 連結, 請問要如何修改, 我要如何使用將TraceId手動設定到ctx ?我使用rkgrpcctx.AddHeaderToClient(ctx, rkmid.HeaderTraceId, traceId)
Q2: client 二個相依的Grpc call, 如何讓此二個在jaeger中相關(trace Id相同)?
Describe the bug
你好,
计划,一个boot.yaml,启动两个服务:grpc 和 gin,不同的 entryName
现在能启动,能通过不同的端口访问到 grpc 和 gin 的服务
但是,访问 sw 时,
只能 grpc 的 sw 正常,gin 的 sw 会提示:Failed to load API definition.
在控制台还会看到日志:2022/05/18 18:19:05 http: TLS handshake error from [::1]:12819: remote error: tls: unknown certificate
不过,访问 自定义的和common service 的路由 都是能正常访问的。
配置如下:
grpc:
- name: grpc-api # Required
description: "grpc api" # Optional, default: ""
enabled: true # Required
port: 58085 # Required
sw:
enabled: true # Optional, default: false
gin:
- name: rest-api
port: 59095 # 监听端口
enabled: true # 开启 gin 微服务
sw:
enabled: true # 开启 Swagger UI,默认路径为 /sw
boot := rkboot.NewBoot()
ginEntry := rkgin.GetGinEntry("rest-api")
ginEntry.Router.GET("/api/v1/aa", restAPIHandler.GetAA)
// Get grpc entry with name
grpcEntry := rkgrpc.GetGrpcEntry("grpc-api")
boot.Bootstrap(context.Background())
Additional context
rk-boot/v2 v2.1.2
rk-entry/v2 v2.1.7
rk-gin/v2 v2.1.2
rk-grpc/v2 v2.1.6
谢谢。
I am trying to set a custom swagger api path, but it works only for default "sw" path.
To Reproduce
Set config in boot.yaml file:
sw: enabled: true path: "api-docs" jsonPath: "docs"
Describe the bug
依赖版本:
github.com/rookie-ninja/rk-boot/v2 v2.2.22
github.com/rookie-ninja/rk-cache/redis v1.2.17
github.com/rookie-ninja/rk-db/mongodb v1.2.18
github.com/rookie-ninja/rk-db/redis v1.2.18
github.com/rookie-ninja/rk-entry/v2 v2.2.22
github.com/rookie-ninja/rk-gin/v2 v2.2.23
现象:
期望结果:
使用环境变量:key1_enable,可以覆盖配置文件中的值
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
I like fiber
https://github.com/gofiber/fiber , It is fast and simple than gin or echo
Will you support fiber in rk-boot ?
If your not I want try do it
I have two question
gin
build a slight and simple micro-service , rk-boot add echo
package . I dont need it , How do you solve it ? I want my application slightHello , Wechat group QRCode is expired.
后端是java的grpc
请问 这里怎么代理远程grpc服务
Describe the bug
A clear and concise description of what the bug is.
Hi,
First of all, really nice work done here.
After setting up jwt middleware I am unable to acess sw even when ignore is set to /sw, how can I know jwt endpoints to get access token?
To Reproduce
Steps to reproduce the behavior:
gin:
- name: greeter # Required
port: 8080 # Required
enabled: true # Required
commonService:
enabled: true # Optional, default: false
sw:
enabled: true # Optional, default: false
docs:
enabled: true # Optional, default: false
middleware:
jwt:
enabled: true # Optional, default: false
ignorePrefix: # Optional, default: []
- "/sw"
Expected behavior
after ignoring /sw I should be able to access sw and retrieve endpoints to get jwt token
Desktop (please complete the following information):
Smartphone (please complete the following information):
Describe the bug
To Reproduce
MacBook Pro
# go.mod
module swagger_rk
go 1.20
require (
github.com/gin-gonic/gin v1.9.1
github.com/rookie-ninja/rk-boot/v2 v2.2.20
github.com/rookie-ninja/rk-gin/v2 v2.2.21
)
require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/pprof v1.4.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rookie-ninja/rk-entry/v2 v2.2.19 // indirect
github.com/rookie-ninja/rk-logger v1.2.13 // indirect
github.com/rookie-ninja/rk-query v1.2.14 // indirect
github.com/rs/xid v1.3.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.16.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.opentelemetry.io/contrib v1.19.0 // indirect
go.opentelemetry.io/otel v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.18.0 // indirect
go.opentelemetry.io/otel/metric v1.18.0 // indirect
go.opentelemetry.io/otel/sdk v1.18.0 // indirect
go.opentelemetry.io/otel/trace v1.18.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/ratelimit v0.3.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/grpc v1.58.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
# boot.yaml
---
gin:
- name: greeter # Required
port: 8080 # Required
enabled: true # Required
sw:
enabled: true # Optional, default: false
# main.go
// Copyright (c) 2021 rookie-ninja
//
// Use of this source code is governed by an Apache-style
// license that can be found in the LICENSE file.
package main
import (
"context"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
rkboot "github.com/rookie-ninja/rk-boot/v2"
rkgin "github.com/rookie-ninja/rk-gin/v2/boot"
)
// @title Swagger Example API
// @version 1.0
// @description This is a sample rk-demo server.
// @termsOfService http://swagger.io/terms/
// @securityDefinitions.basic BasicAuth
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
func main() {
// Create a new boot instance.
boot := rkboot.NewBoot()
// Register handler
entry := rkgin.GetGinEntry("greeter")
entry.Router.GET("/v1/greeter", Greeter)
// Bootstrap
boot.Bootstrap(context.TODO())
boot.WaitForShutdownSig(context.TODO())
}
// Greeter handler
// @Summary Greeter
// @Id 1
// @Tags Hello
// @version 1.0
// @Param name query string true "name"
// @produce application/json
// @Success 200 {object} GreeterResponse
// @Router /v1/greeter [get]
func Greeter(ctx *gin.Context) {
ctx.JSON(http.StatusOK, &GreeterResponse{
Message: fmt.Sprintf("Hello %s!", ctx.Query("name")),
})
}
type GreeterResponse struct {
Message string
}
Expected behavior
$ curl -X GET localhost:8080/rk/v1/ready
{
"ready": true
}
$ curl -X GET localhost:8080/rk/v1/alive
{
"alive": true
}
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
Cloud provider entry may be useful for rk-boot.
Describe the solution you'd like
Any plan to support orm xorm
?
Is your feature request related to a problem? Please describe.
Currently, rk-boot support gRPC and Gin RPC framework. More needs to be supported.
Describe the solution you'd like
Support bellow popular frameworks.
Support database entry in rk-boot
See rk-db for details.
error
~/.go/pkg/mod/github.com/rookie-ninja/[email protected]/entry/rk_meta_entry.go:104:10: undefined: rkcommon.GetRkMetaFromCmd
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.