fracker

package module
v0.0.0-...-bf5fac0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2014 License: MIT Imports: 5 Imported by: 0

README

fracker

fracker is a small utility for converting directory hierarchies in etcd to shell environment variables.

Usage

fracker <key> [<key> <key> ...]

fracker reads the directory trees at the given keys, collects all the leaf values and writes environment variable declarations to standard out.

Assume you have the following directory structure in etcd:

/foo
  |__ /bar
  |     |__ /val = "1234"
  |
  |__ /baz
        |__ /woo = "abcd"
        |__ /hoo = "efgh"

fracker foo will output the following to standard out:

FOO_BAR_VAL=1234
FOO_BAZ_WOO=abcd
FOO_BAZ_HOO=efgh

Whereas fracker foo/bar will only output FOO_BAR_VAL=1234. Duplicate keys are output only once with the last value read from etcd, meaning fracker foo/bar foo/bar/val will only output FOO_BAR_VAL=1234.

The output is intended to be redirected into a file such as /etc/environment for service configuration.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(key string) (Node, error)
}

func NewClient

func NewClient(hosts []string) Client

type Fracker

type Fracker interface {
	// Frack() looks up each of the given keys in etcd and walks the tree of nodes returned. Each leaf
	// value is converted into a environment variable declaration and written to the given io.Writer.
	Frack(io.Writer, []string) error
}

A Fracker drills into etcd directories and outputs the values to a given outlet.

func New

func New(client Client) Fracker

New() creates a new Fracker.

type Node

type Node interface {
	Each(func(string, string))
}

func NewNode

func NewNode(n *etcd.Node) Node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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