gateway

package module
v0.0.0-...-867a5a3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 13 Imported by: 0

README

gateway

Build Status | codecov | Go Report Card | GoDoc

A simple service gateway that allows you to centralize all your apis.

If i miss something or you have something interesting, please be part of this project. Let me know! My contact is at the end.

Dependecy Management

Dependency

Project dependencies are managed using Dep. Read more about Dep.

  • Get dependency manager: go get github.com/joaosoft/dependency
  • Install dependencies: dependency get
Go
go get github.com/joaosoft/gateway

Known issues

Follow me at

Facebook: https://www.facebook.com/joaosoft

LinkedIn: https://www.linkedin.com/in/jo%C3%A3o-ribeiro-b2775438/

If you have something to add, please let me know joaosoft@gmail.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(file string) bool

func GetEnv

func GetEnv() string

func ReadFile

func ReadFile(file string, obj interface{}) ([]byte, error)

func ReadFileLines

func ReadFileLines(file string) ([]string, error)

func WriteFile

func WriteFile(file string, obj interface{}) error

Types

type AliveResponse

type AliveResponse struct {
	Message string `json:"message"`
}

type AppConfig

type AppConfig struct {
	Gateway *GatewayConfig `json:"gateway"`
}

AppConfig ...

func NewConfig

func NewConfig() (*AppConfig, manager.IConfig, error)

NewConfig ...

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(config *GatewayConfig) (*Controller, error)

func (*Controller) Alive

func (c *Controller) Alive(ctx *web.Context) error

func (*Controller) RedirectAcl

func (c *Controller) RedirectAcl(ctx *web.Context) error

func (*Controller) RedirectAuth

func (c *Controller) RedirectAuth(ctx *web.Context) error

func (*Controller) RedirectProfile

func (c *Controller) RedirectProfile(ctx *web.Context) error

func (*Controller) RegisterRoutes

func (c *Controller) RegisterRoutes(w manager.IWeb) error

type ErrorResponse

type ErrorResponse struct {
	Code    web.Status `json:"code,omitempty"`
	Message string     `json:"message,omitempty"`
	Cause   string     `json:"cause,omitempty"`
}

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

func NewGateway

func NewGateway(options ...GatewayOption) (*Gateway, error)

NewGateway ...

func (*Gateway) Reconfigure

func (gateway *Gateway) Reconfigure(options ...GatewayOption)

Reconfigure ...

func (*Gateway) Start

func (gateway *Gateway) Start() error

Start ...

func (*Gateway) Stop

func (gateway *Gateway) Stop() error

Stop ...

type GatewayConfig

type GatewayConfig struct {
	Host     string    `json:"host"`
	Services *Services `json:"services"`
	TokenKey string    `json:"token_key"`
	Log      struct {
		Level string `json:"level"`
	} `json:"log"`
}

GatewayConfig ...

type GatewayOption

type GatewayOption func(auth *Gateway)

GatewayOption ...

func WithConfiguration

func WithConfiguration(config *GatewayConfig) GatewayOption

WithConfiguration ...

func WithLogLevel

func WithLogLevel(level logger.Level) GatewayOption

WithLogLevel ...

func WithLogger

func WithLogger(logger logger.ILogger) GatewayOption

WithLogger ...

func WithManager

func WithManager(mgr *manager.Manager) GatewayOption

WithManager ...

type Services

type Services struct {
	Auth    string `json:"auth"`
	Profile string `json:"profile"`
	Acl     string `json:"acl"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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