config

package
v0.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Version = "0.4.0"
)

Variables

View Source
var (
	BASE_INFO_NAME = "name"
	BASE_INFO_DESC = "description"
)

Functions

func Adapter

func Adapter(cfg *model.Bootstrap) (err error)

func CheckYamlFormat

func CheckYamlFormat(path string) bool

func GetBootstrap

func GetBootstrap() *model.Bootstrap

GetBootstrap get config global, need a better name

func GetDiscoveryType

func GetDiscoveryType(cfg *model.Bootstrap) (err error)

func GetHttpConfig

func GetHttpConfig(cfg *model.Bootstrap) (err error)

func GetLoadBalance

func GetLoadBalance(cfg *model.Bootstrap) (err error)

func GetProtocol

func GetProtocol(cfg *model.Bootstrap) (err error)

func Load

func Load(path string) *model.Bootstrap

Load config file and parse

func LoadAPIConfig

func LoadAPIConfig(metaConfig *model.APIMetaConfig) (*fc.APIConfig, error)

LoadAPIConfig load the api config from config center

func LoadAPIConfigFromFile

func LoadAPIConfigFromFile(path string) (*fc.APIConfig, error)

LoadAPIConfigFromFile load the api config from file

func LoadYAMLConfig

func LoadYAMLConfig(path string) *model.Bootstrap

LoadYAMLConfig YAMLConfigLoad config load yaml

func RegisterConfigListener

func RegisterConfigListener(li APIConfigResourceListener)

RegisterConfigListener register APIConfigListener

func RegisterConfigLoadFunc

func RegisterConfigLoadFunc(f LoadFunc)

RegisterConfigLoadFunc can replace a new config load function instead of default

Types

type APIConfigResourceListener

type APIConfigResourceListener interface {
	// ResourceChange handle modify resource event
	ResourceChange(new fc.Resource, old fc.Resource) bool // bool is return for interface implement is interesting
	// ResourceAdd handle add resource event
	ResourceAdd(res fc.Resource) bool
	// ResourceDelete handle delete resource event
	ResourceDelete(deleted fc.Resource) bool
	// MethodChange handle modify method event
	MethodChange(res fc.Resource, method fc.Method, old fc.Method) bool
	// MethodAdd handle add method below one resource event
	MethodAdd(res fc.Resource, method fc.Method) bool
	// MethodDelete handle delete method event
	MethodDelete(res fc.Resource, method fc.Method) bool
}

APIConfigResourceListener defines api resource and method config listener interface

type LoadFunc

type LoadFunc func(path string) *model.Bootstrap

LoadFunc ConfigLoadFunc parse a input(usually file path) into a pixiu config

Jump to

Keyboard shortcuts

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