gfconf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorConfigNotLoaded  = fmt.Errorf("config not loaded")
	ErrorConfigInitFailed = fmt.Errorf("config init failed")
)

Functions

func LoadConfig

func LoadConfig(paths []string, remoteCfg *RemoteConfig) error

func MustInitNacos

func MustInitNacos(nacos NacosConf, register LoaderRegister)

func MustLoadConfig

func MustLoadConfig(paths []string, remoteCfg *RemoteConfig)

func RegisterLoader

func RegisterLoader(filename string, loader func(*viper.Viper)) error

Types

type BasicAuth

type BasicAuth = nacos.BasicAuth

type Configure

type Configure interface {
	Init() error
	GetConfig(path string) (*viper.Viper, error)
	WatchConfig(path string, watchFn func(vip *viper.Viper)) error
}

type LoaderRegister

type LoaderRegister interface {
	Register() error
}

type LocalConfigure

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

func NewLocalConfigure

func NewLocalConfigure(paths []string) *LocalConfigure

func (*LocalConfigure) GetConfig

func (c *LocalConfigure) GetConfig(path string) (*viper.Viper, error)

func (*LocalConfigure) Init

func (c *LocalConfigure) Init() error

func (*LocalConfigure) WatchConfig

func (c *LocalConfigure) WatchConfig(path string, watchFn func(vip *viper.Viper)) error

type NacosConf

type NacosConf struct {
	Enabled  bool     `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	Host     string   `json:"host" yaml:"host" mapstructure:"host"`
	Port     uint64   `json:"port" yaml:"port" mapstructure:"port"`
	Username string   `json:"username" yaml:"username" mapstructure:"username"`
	Password string   `json:"password" yaml:"password" mapstructure:"password"`
	Paths    []string `json:"paths" yaml:"paths" mapstructure:"paths"`
}

type NacosConfigure

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

func NewNacosConfigure

func NewNacosConfigure(paths []string, endpoint string, auth ...BasicAuth) *NacosConfigure

func (*NacosConfigure) GetConfig

func (c *NacosConfigure) GetConfig(path string) (*viper.Viper, error)

func (*NacosConfigure) Init

func (c *NacosConfigure) Init() error

func (*NacosConfigure) WatchConfig

func (c *NacosConfigure) WatchConfig(path string, watchFn func(vip *viper.Viper)) error

type RemoteConfig

type RemoteConfig struct {
	Enabled  bool
	Host     string
	Port     uint64
	Username string
	Password string
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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