config

package
v0.0.0-...-5ab17cb Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidProviders = []string{
	"postgres",
}

Functions

This section is empty.

Types

type API

type API struct {
	Address string `yaml:"address"`
	User    User   `yaml:"user"`
}

func (API) Validate

func (a API) Validate() error

type Backend

type Backend struct {
	Name    string            `yaml:"name"`
	Host    string            `yaml:"host"`
	Scopes  []string          `yaml:"scopes"`
	Headers map[string]string `yaml:"headers"`
	Routes  []Route           `yaml:"routes"`
}

func (Backend) APIGatekeeperBackend

func (Backend) APIGatekeeperBackend(userHandler apiGatekeeperUserHandler) Backend

func (*Backend) Normalize

func (b *Backend) Normalize()

func (Backend) Validate

func (b Backend) Validate() error

func (*Backend) ValidateAndNormalize

func (b *Backend) ValidateAndNormalize() error

type Config

type Config struct {
	API      API       `yaml:"api"`
	Database Database  `yaml:"database"`
	Backends []Backend `yaml:"backends"`
}

func LoadConfigFromYamlFile

func LoadConfigFromYamlFile(configPath *string) (*Config, error)

func (Config) ValidateAndNormalize

func (c Config) ValidateAndNormalize() error

type Database

type Database struct {
	Provider string `yaml:"provider"`
	DSN      string `yaml:"dsn"`
}

func (Database) Validate

func (d Database) Validate() error

type Route

type Route struct {
	Method         string            `yaml:"method"`
	BackendPath    string            `yaml:"backendPath"`
	GatekeeperPath string            `yaml:"gatekeeperPath"`
	TimeoutSeconds int               `yaml:"timeoutSeconds"`
	IsPublic       bool              `yaml:"isPublic"`
	Scopes         []string          `yaml:"scopes"`
	Headers        map[string]string `yaml:"headers"`
	HandlerFunc    http.HandlerFunc
}

func (Route) Name

func (r Route) Name() string

func (*Route) Normalize

func (r *Route) Normalize()

func (*Route) Pattern

func (r *Route) Pattern() string

func (*Route) PatternVariables

func (r *Route) PatternVariables() []RouteVariable

func (Route) Validate

func (r Route) Validate() error

func (*Route) ValidateAndNormalize

func (r *Route) ValidateAndNormalize() error

type RouteVariable

type RouteVariable string

func NewRouteVariable

func NewRouteVariable(routeVariable string) RouteVariable

func (RouteVariable) Name

func (r RouteVariable) Name() string

func (RouteVariable) ReplaceFromPattern

func (r RouteVariable) ReplaceFromPattern(url string, value string) string

type User

type User struct {
	Login    string `yaml:"login"`
	Password string `yaml:"password"`
}

func (User) Validate

func (u User) Validate() error

Jump to

Keyboard shortcuts

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