consul

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

consul

import "github.com/betterdoctor/duncan/consul"

Overview

Index

Package files

api.go

func Delete

func Delete(app, deployEnv, url string, keys []string) error

Delete removes key/values from Consul by given keys

func EnvURL

func EnvURL(app, env string) string

EnvURL returns a Consul KV URL for an app/env

func Read

func Read(url string) (map[string]string, error)

Read returns ENV for given consul KV URL

func TxnURL

func TxnURL() string

TxnURL returns a Consul transaction (txn) URL

func Write

func Write(app, deployEnv, url string, kvs []string) (map[string]string, error)

Write sets ENV vars for a given KV URL and prints what changed

e.g., changing FOO_LEVEL from 9 => 9000 changing BAR_ENABLED from true => false

type KVPair

type KVPair struct {
    Key   string `json:"Key"`
    Value string `json:"Value"`
    Verb  string `json:"Verb,omitempty"`
}

KVPair represents an individual key/value pair

type TxnItem

type TxnItem struct {
    KV *KVPair `json:"KV"`
}

TxnItem represents a KV element in a transaction


Generated by godoc2md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(app, deployEnv, url string, keys []string) error

Delete removes key/values from Consul by given keys

func EnvURL

func EnvURL(app, env string, strictMatch bool) string

EnvURL returns a Consul KV URL for an app/env

func Read

func Read(url string) (map[string]string, error)

Read returns ENV for given consul KV URL

func TxnURL added in v1.9.0

func TxnURL() string

TxnURL returns a Consul transaction (txn) URL

func Write

func Write(app, deployEnv, url string, kvs []string) (map[string]string, error)

Write sets ENV vars for a given KV URL and prints what changed

e.g., changing FOO_LEVEL from 9 => 9000 changing BAR_ENABLED from true => false

Types

type KVPair

type KVPair struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
	Verb  string `json:"Verb,omitempty"`
}

KVPair represents an individual key/value pair

type TxnItem

type TxnItem struct {
	KV *KVPair `json:"KV"`
}

TxnItem represents a KV element in a transaction

Jump to

Keyboard shortcuts

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