rkembed

package module
v2.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

README

rk-entry

build codecov Go Report Card License

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

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.

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

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 lark@rkdev.info.

Released under the Apache 2.0 License.

Documentation

Overview

Package rkembed is a static files which aims to include assets files into embed.FS

Index

Constants

This section is empty.

Variables

View Source
var AssetsFS embed.FS

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package rkerror defines RK style API errors.
Package rkerror defines RK style API errors.
auth
Package rkmidauth provide auth related options
Package rkmidauth provide auth related options
cors
Package rkmidcors provide cors related options
Package rkmidcors provide cors related options
csrf
Package rkmidcsrf provide auth related options
Package rkmidcsrf provide auth related options
jwt
Package rkmidjwt is a middleware for JWT
Package rkmidjwt is a middleware for JWT
log
Package rkmidlog provide options
Package rkmidlog provide options
meta
Package rkmidmeta is a middleware for metadata
Package rkmidmeta is a middleware for metadata
panic
Package rkmidpanic provide options
Package rkmidpanic provide options
prom
Package rkmidprom has a couple of utility functions to start prometheus and pushgateway client locally.
Package rkmidprom has a couple of utility functions to start prometheus and pushgateway client locally.
ratelimit
Package rkmidlimit provide options
Package rkmidlimit provide options
secure
Package rkmidsec provide auth related options
Package rkmidsec provide auth related options
timeout
Package rkmidtimeout provide options
Package rkmidtimeout provide options
tracing
Package rkmidtrace is a middleware for recording tracing
Package rkmidtrace is a middleware for recording tracing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL