GithubHelp home page GithubHelp logo

mrigesh / rk-entry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rookie-ninja/rk-entry

0.0 0.0 0.0 7.98 MB

Base definition of rk-boot plugins. rk-boot is a library to start goLang microservice from YAML

License: Apache License 2.0

Go 98.32% Makefile 0.17% HTML 1.51%

rk-entry's Introduction

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 [email protected].

Released under the Apache 2.0 License.

rk-entry's People

Contributors

dongxuny avatar swordkee avatar zhengguo07q avatar mrigesh-dq avatar shengyu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.