grpc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: Apache-2.0 Imports: 5 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 consul 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(consulSource)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPath    = "/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

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