nacos

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 12 Imported by: 6

README

Nacos Config

import (
	"github.com/nacos-group/nacos-sdk-go/clients"
	"github.com/nacos-group/nacos-sdk-go/common/constant"
)


sc := []constant.ServerConfig{
	*constant.NewServerConfig("127.0.0.1", 8848),
}

cc := &constant.ClientConfig{
	NamespaceId:         "public", //namespace id
	TimeoutMs:           5000,
	NotLoadCacheAtStart: true,
	LogDir:              "/tmp/nacos/log",
	CacheDir:            "/tmp/nacos/cache",
	RotateTime:          "1h",
	MaxAge:              3,
	LogLevel:            "debug",
}

// a more graceful way to create naming client
client, err := clients.NewConfigClient(
	vo.NacosClientParam{
		ClientConfig:  cc,
		ServerConfigs: sc,
	},
)
if err != nil {
	log.Panic(err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigSource

func NewConfigSource(client config_client.IConfigClient, opts options) config.Source

Types

type Config

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

func (*Config) Load

func (c *Config) Load() ([]*config.KeyValue, error)

func (*Config) Name

func (c *Config) Name() string

func (*Config) Watch

func (c *Config) Watch() (config.Watcher, error)

type Watcher

type Watcher struct {
	context.Context
	// contains filtered or unexported fields
}

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) Next

func (w *Watcher) Next() ([]*config.KeyValue, error)

func (*Watcher) Stop

func (w *Watcher) Stop() error

Jump to

Keyboard shortcuts

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