etcd

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 13 Imported by: 0

README

Router configuration etcd loader

Usage:

  • Create a key named "router_conf" in etcd to manage the router configuration.
  • Import the etcd loader anonymously in the main.go file of the project.
import    _ "trpc.group/trpc-go/trpc-gateway/core/loader/etcd"
  • Specify the etcd loader in the trpc_go.yaml framework configuration and configure the etcd address.
global: # Global configuration
  conf_provider: etcd        # Specify the etcd loader
server:
  app: ${app}                                               # Application name
  server: ${server}                                         # Process server name
  service: # Services provided by the business
    - name: trpc.${app}.${server}.gateway    # Service route name, replace ReplaceMe with your own service name, do not change app and server placeholders
plugins:
  # Configure etcd information, refer to: https://git.woa.com/trpc-go/trpc-config-etcd
  config:
    etcd:
      endpoints: ["http://127.0.0.1:2380"]

Documentation

Overview

Package etcd provides a router config loader with etcd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfLoader

type ConfLoader struct {
}

ConfLoader is the router configuration loader with etcd.

func (*ConfLoader) LoadConf

func (l *ConfLoader) LoadConf(ctx context.Context, protocol string) (err error)

LoadConf loads the configuration from etcd.

Jump to

Keyboard shortcuts

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