Categorygithub.com/rookie-ninja/rk-entry/v2
modulepackage
2.2.22
Repository: https://github.com/rookie-ninja/rk-entry.git
Documentation: pkg.go.dev

# README

rk-entry

build codecov Go Report Card License

Base library for RK family, includes Entry interface, Builtin Entries and Web Framework middleware base.

NameDescription
EntryInterface
AppInfoEntryBuiltin entry, collect application, process info
CertEntryBuiltin entry, parse certificates from path
ConfigEntryBuiltin entry, parse config file from path
EventEntryBuiltin entry, create event logger for recording RPC calls
LoggerEntryBuiltin entry, create logger instance
CommonServiceEntryBuiltin entry, provide http handler of commonly used API, used for web framework entry
DocsEntryBuiltin entry, provide http handler of rapiDoc UI, used for web framework entry
PromEntryBuiltin entry, provide http handler of prometheus client, used for web framework entry
StaticFileHandlerEntryBuiltin entry, provide http handler of static file handler, used for web framework entry
SWEntryBuiltin entry, provide http handler of swagger UI, used for web framework entry
authMiddleware base for auth
corsMiddleware base for cors
csrfMiddleware base for csrf
jwtMiddleware base for jwt
logMiddleware base for log
metaMiddleware base for meta
panicMiddleware base for panic
promMiddleware base for prom
ratelimitMiddleware base for ratelimit
secureMiddleware base for secure
timeoutMiddleware base for timeout
tracingMiddleware base for tracing

Notice of V2!

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.

Installation

go get github.com/rookie-ninja/rk-entry/v2

Quick Start

Entry

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

Example

Interact with rk-boot.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().

GlobalAppCtx

A struct called AppContext witch contains RK style application metadata.

ElementDescriptionJSONDefault values
startTimeApplication start time.startTime0001-01-01 00:00:00 +0000 UTC
appInfoEntrySee ApplicationInfoEntry for detail.appInfoEntryIncludes application info specified by user.
entriesUser implemented Entry.externalEntriesIncludes user implemented Entry configuration initiated by user.
userValuesUser K/V registered from code.userValuesempty map
shutdownSigShutdown signals which includes syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT.shutdown_sigchannel includes syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT
shutdownHooksShutdown hooks registered from user code.shutdown_hooksempty list

How to use?

rk-entry should be used as base package for applications which hope to start with YAML.

Please refer rk-gin as example.

Contributing

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.

# Packages

No description provided by the author
No description provided by the author
Package rkerror defines RK style API errors.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

go:embed assets/*.