Giter VIP home page Giter VIP logo

krakend-cobra's Introduction

KrakenD Cobra

An adapter of the cobra lib for the KrakenD framework

Package cmd defines the cobra command structs and an execution method for adding an improved CLI to KrakenD based api gateways

Basic example

package main

import (
	"os"

	"github.com/davron112/krakend-cobra/v2"
	"github.com/davron112/krakend-viper/v2"
	"github.com/davron112/lura/v2/config"
	"github.com/davron112/lura/v2/logging"
	"github.com/davron112/lura/v2/proxy"
	krakendgin "github.com/davron112/lura/v2/router/gin"
)

func main() {

	cmd.Execute(viper.New(), func(serviceConfig config.ServiceConfig) {
		logger, _ := logging.NewLogger("DEBUG", os.Stdout, "")
		krakendgin.DefaultFactory(proxy.DefaultFactory(logger), logger).New().Run(serviceConfig)
	})

}

Available commands

The cmd package includes four commands: check, check-plugin, help and run.

  1. check validates the received config file.
  2. check-plugin validates the dependencies shared between the binary and a plugin.
  3. help displays details about any command.
  4. run executes the passed executor once the received flags overwrite the parsed config.
$ ./krakend
 ╓▄█                          ▄▄▌                               ╓██████▄µ
▐███  ▄███╨▐███▄██H╗██████▄  ║██▌ ,▄███╨ ▄██████▄  ▓██▌█████▄  ███▀╙╙▀▀███╕
▐███▄███▀  ▐█████▀"╙▀▀"╙▀███ ║███▄███┘  ███▀""▀███ ████▀╙▀███H ███     ╙███
▐██████▌   ▐███⌐  ,▄████████M║██████▄  ║██████████M███▌   ███H ███     ,███
▐███╨▀███µ ▐███   ███▌  ,███M║███╙▀███  ███▄```▄▄` ███▌   ███H ███,,,╓▄███▀
▐███  ╙███▄▐███   ╙█████████M║██▌  ╙███▄`▀███████╨ ███▌   ███H █████████▀
                     ``                     `'`
Version: undefined

The API Gateway builder

Usage:
  krakend [command]

Available Commands:
  check        Validates that the configuration file is valid.
  check-plugin Checks your plugin dependencies are compatible.
  help         Help about any command
  run          Runs the KrakenD server.

Flags:
  -h, --help   help for krakend

Use "krakend [command] --help" for more information about a command.

krakend-cobra's People

Contributors

alombarte avatar davron112 avatar deepsource-autofix[bot] avatar deepsourcebot avatar dhontecillas avatar kpacha avatar taik0 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.