config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 8 Imported by: 0

README

Polaris Config

import (
	"log"
	
	"github.com/polarismesh/polaris-go"
	
	"github.com/go-kratos/kratos/contrib/config/polaris/v2"
)

func main() {
    configApi, err := polaris.NewConfigAPI()
    if err != nil {
    	log.Fatalln(err)
    }

    source, err := New(&configApi, WithNamespace("default"), WithFileGroup("default"), WithFileName("default.yaml"))
    if err != nil {
    	log.Fatalln(err)
    }
    source.Load()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(client polaris.ConfigAPI, opts ...Option) (config.Source, error)

Types

type Option

type Option func(o *options)

Option is polaris config option.

func WithFileGroup

func WithFileGroup(fileGroup string) Option

WithFileGroup with polaris config fileGroup

func WithFileName

func WithFileName(fileName string) Option

WithFileName with polaris config fileName

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace with polaris config namespace

type Watcher

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

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