Base library for RK family, includes Entry interface, Builtin Entries and Web Framework middleware base.
Name | Description |
---|---|
Entry | Interface |
AppInfoEntry | Builtin entry, collect application, process info |
CertEntry | Builtin entry, parse certificates from path |
ConfigEntry | Builtin entry, parse config file from path |
EventEntry | Builtin entry, create event logger for recording RPC calls |
LoggerEntry | Builtin entry, create logger instance |
CommonServiceEntry | Builtin entry, provide http handler of commonly used API, used for web framework entry |
DocsEntry | Builtin entry, provide http handler of rapiDoc UI, used for web framework entry |
PromEntry | Builtin entry, provide http handler of prometheus client, used for web framework entry |
StaticFileHandlerEntry | Builtin entry, provide http handler of static file handler, used for web framework entry |
SWEntry | Builtin entry, provide http handler of swagger UI, used for web framework entry |
auth | Middleware base for auth |
cors | Middleware base for cors |
csrf | Middleware base for csrf |
jwt | Middleware base for jwt |
log | Middleware base for log |
meta | Middleware base for meta |
panic | Middleware base for panic |
prom | Middleware base for prom |
ratelimit | Middleware base for ratelimit |
secure | Middleware base for secure |
timeout | Middleware base for timeout |
tracing | Middleware base for tracing |
rookie-ninja/rk-entry is under big refactoring stage.
New version will be start with v2.x.x and may not compatible with v1.x.x.
Please do not upgrade to the newest master branch.
go get github.com/rookie-ninja/rk-entry/v2
rkentry.Entry is an interface which can be started from YAML config file by calling UnmarshalBoot() function
Users can implement rkentry.Entry interface and bootstrap any service/process with rkboot.Bootstrapper
1: Entry will be created and registered into rkentry.GlobalAppCtx.
2: rkboot.Bootstrap() function will iterator all entries in rkentry.GlobalAppCtx.Entries and call Bootstrap().
3: Application will wait for shutdown signal via rkentry.GlobalAppCtx.ShutdownSig.
4: rkboot.Interrupt() function will iterate all entries in rkentry.GlobalAppCtx.Entries and call Interrupt().
A struct called AppContext witch contains RK style application metadata.
Element | Description | JSON | Default values |
---|---|---|---|
startTime | Application start time. | startTime | 0001-01-01 00:00:00 +0000 UTC |
appInfoEntry | See ApplicationInfoEntry for detail. | appInfoEntry | Includes application info specified by user. |
entries | User implemented Entry. | externalEntries | Includes user implemented Entry configuration initiated by user. |
userValues | User K/V registered from code. | userValues | empty map |
shutdownSig | Shutdown signals which includes syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT. | shutdown_sig | channel includes syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT |
shutdownHooks | Shutdown hooks registered from user code. | shutdown_hooks | empty list |
rk-entry should be used as base package for applications which hope to start with YAML.
Please refer rk-gin as example.
We encourage and support an active, healthy community of contributors — including you! Details are in the contribution guide and the code of conduct. The rk maintainers keep an eye on issues and pull requests, but you can also report any negative conduct to [email protected].
Released under the Apache 2.0 License.