config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CorrelationId string = "Correlation-ID"
)

Variables

This section is empty.

Functions

func GetListen

func GetListen() string

GetListen return the listening address for api

func GetTimeout

func GetTimeout() time.Duration

GetTimeout return the timeout set in config

func IsAuth

func IsAuth() bool

IsAuth return a toggle against Auth config

func IsInArray

func IsInArray(needle string, haystack []string) bool

IsInArray checks if the needle in part of haystack

func New

func New(filename string) error

func SetAuth

func SetAuth(auth []Auth)

SetAuth return the auth list from config

func SetListen

func SetListen(address string)

SetListen return the listening address for api

func SetTimeout

func SetTimeout(timeout int64) error

SetTimeout record the timeout in config

Types

type Auth

type Auth struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

func GetAuth

func GetAuth() []Auth

GetAuth return the auth list from config

type Config

type Config struct {
	// Listen address binding the api
	Listen string `json:"listen"   yaml:"listen"`

	// Timeout is the time in minute until the watch for resource will be end
	Timeout int64 `json:"timeout"  yaml:"timeout"`

	// Auth is a list of credentials
	// it should be content the username and password
	Auth []Auth `json:"auth"     yaml:"auth"`

	// Hooks is a list of subscriber where to send the status
	// it should be respect the url format
	// example for kafka :
	// kafka://localhost:9092?topic=MY-TOPIC
	Hooks []Hook `json:"hooks" yaml:"hooks"`
}

func GetConfig

func GetConfig() *Config

GetConfig return the Config instance

type Hook added in v0.1.3

type Hook struct {
	URL   string `json:"url"  yaml:"url"`
	Scope string `json:"scope" yaml:"scope"`
}

Jump to

Keyboard shortcuts

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