config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = NewConfig()
)

Functions

func Get

func Get(path ...string) reader.Value

func ServerName

func ServerName() string

todo, doest work

Types

type Broker

type Broker struct {
	Address string `json:"address"`
	Name    string `json:"name" `
}

type Client

type Client struct {
	Protocol string        `json:"protocol"`
	Pool     Pool          `json:"pool"`
	Request  ClientRequest `json:"request"`
}

type ClientRequest

type ClientRequest struct {
	Retries json.Number `json:"retries"`
	Timeout json.Number `json:"timeout"`
}

type Config

type Config interface {
	reader.Values
	Init(opts ...Option) error
	Close() error
}

func NewConfig

func NewConfig(opts ...Option) Config

Init Stack's Config component Any developer Don't use this Func anywhere. NewConfig works for Stack Framework only

type Logger

type Logger struct {
	Name  string `json:"name"`
	Level string `json:"level"`
}

type Metadata

type Metadata []string

func (Metadata) Value

func (m Metadata) Value(k string) string

type Option

type Option func(o *Options)

func Source

func Source(s ...source.Source) Option

func Storage

func Storage(s bool) Option

func Watch

func Watch(w bool) Option

type Options

type Options struct {
	Sources []source.Source
	Storage bool
	Watch   bool
}

type Pool

type Pool struct {
	Size json.Number `json:"size"`
	TTL  json.Number `json:"ttl"`
}

type Registry

type Registry struct {
	Address  string      `json:"address"`
	Interval json.Number `json:"interval"`
	Name     string      `json:"name"`
	TTL      json.Number `json:"ttl"`
}

type Selector

type Selector struct {
	Name string `json:"name"`
}

type Server

type Server struct {
	Address   string   `json:"address"`
	Advertise string   `json:"advertise"`
	ID        string   `json:"id"`
	Metadata  Metadata `json:"metadata"`
	Name      string   `json:"name"`
	Protocol  string   `json:"protocol"`
	Version   string   `json:"version"`
}

type Stack

type Stack struct {
	Broker    Broker    `json:"broker"`
	Client    Client    `json:"client"`
	Profile   string    `json:"profile"`
	Registry  Registry  `json:"registry"`
	Runtime   string    `json:"runtime"`
	Server    Server    `json:"server"`
	Selector  Selector  `json:"selector"`
	Transport Transport `json:"transport"`
	Logger    Logger    `json:"logger"`
}

type Transport

type Transport struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type Value

type Value struct {
	Stack Stack `json:"stack"`
}

func GetDefault

func GetDefault() *Value

Jump to

Keyboard shortcuts

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