clientconfig

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: BSD-2-Clause Imports: 10 Imported by: 4

README

etcd-client-from-env

This library reads environment variables and returns a clientv3.Config.

It makes it easy to write tools against etcd that give the user control over how to connect to etcd.

It currently supports the following settings (but we welcome contributions). Each setting can also be passed by setting k_FILE (like ETCD_SERVER_CA_FILE) to a filename from where to read the value.

  • ETCD_ENDPOINTS: A comma separated list of etcd endpoints. (required)
  • ETCD_USERNAME: Username for etcd authentication.
  • ETCD_PASSWORD: Password for etcd authentication.
  • ETCD_USERNAME_AND_PASSWORD: username:password pair (separated by a colon) for etcd authentication.
  • ETCD_INSECURE_SKIP_VERIFY: "true" to disable verification of the etcd server certificate (insecure).
  • ETCD_SERVER_CA: PEM encoded CA certificate that has signed the server certificate.
  • ETCD_CLIENT_CERT: PEM encoded certificate for CN authentication.
  • ETCD_CLIENT_KEY: PEM encoded private key for CN authentication.

All settings are optional except ETCD_ENDPOINTS. If you pass a username, you must also pass a password and vice versa. Same for a client cert/key.

Documentation

Overview

Package clientconfig constructs a Config for connecting to etcd.

You can use the simple mode and only call Get and use our defaults. If you want to customize defaults, either do that on Get's return value, or first call Defaults, modify it and then call Apply to read the environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(c clientv3.Config) (clientv3.Config, error)

Apply reads the environment variables and returns a modified copy of the given config.

func Defaults

func Defaults() clientv3.Config

Defaults are the defaults used by this library, but you can overwrite them. After overwriting them, pass the Config to Apply to get the configuration from the environment.

func Get

func Get() (clientv3.Config, error)

Get is the easiest way to get a clientv3.Config if you don't have any defaults that have less priority than client configuration.

Types

This section is empty.

Jump to

Keyboard shortcuts

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