grpc

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

gRPC Source

The gRPC source reads from a gRPC server

Server

A gRPC source server should implement the Source proto interface.

service Source {
	rpc Read(ReadRequest) returns (ReadResponse) {};
	rpc Watch(WatchRequest) returns (stream WatchResponse) {};
}

New Source

Specify source with address and path

source := grpc.NewSource(
	// optionally specify server address; default to localhost:8080
	grpc.WithAddress("10.0.0.10:8500"),
	// optionally specify a path; defaults to /micro/config
	grpc.WithPath("/my/config/path"),
)

Load Source

Load the source into config

// Create new config
conf := config.NewConfig()

// Load file source
conf.Load(grpcSource)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPath    = "/focalsolution/micro-config"
	DefaultAddress = "localhost:8080"
)

Functions

func NewSource

func NewSource(opts ...source.Option) source.Source

func WithAddress

func WithAddress(a string) source.Option

WithAddress sets the consul address

func WithPath

func WithPath(p string) source.Option

WithPath sets the key prefix to use

func WithTLS

func WithTLS(t *tls.Config) source.Option

WithTLS sets the TLS config for the service

Types

This section is empty.

Directories

Path Synopsis
Package grpc is a generated protocol buffer package.
Package grpc is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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