casper

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

CASPER

Configuration Automation for Safe and Painless Environment Releases

Build Status Coverage Status Go Report Card

Description

Casper is a simple tool for managing configurations as code where the structure of the configurations is separated from the values themselves. That way you can use the same structure for different environments. The structure of the configurations is described in a template file. Overall the tool combines the template file with all the values, serializes it to a format applicable for the configuration storage and pushes the changes to the storage.

Installation

From source
go get -u github.com/miracl/casper/cmd/casper
From GitHub releases

Example

cd examples/
casper build

Usage

All configurations can be given on the command line, with file or with environment variables. Check casper -h for full list.

  • template - The template file is a golang template. The end product of the template file and the values should be of a format applicable for the configuration storage (e.g: json, yaml for key/value stores)
  • sources - Sources are the thing containing the keys for the template. Sources is a list. Currently there are 2 available:
    • Config source is a list of key/value pairs directly in the configuration file. Check (config.yaml) for examples.
      sources:
      - key1=val1
      - key2=val2
      
    • File source defines key/value pairs in a file. Currently supported formats are json and yaml.
      sources:
      - file://source.yaml
      
  • storage - Storage is the system that Casper menages. Currently there are 2 available:
    • Consul.
      storage: consul
      consul-addr: http://172.17.0.1:8500/?token=acl_token&ignore=_ignore
      
      • ignore - keys given the value of this setting in configuration will be ignored by Casper. The default such value is _ignore
    • File
      storage: file
      file-path: output.yaml
      

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildConfig

type BuildConfig struct {
	Template io.Reader
	Source   source.Getter
}

BuildConfig represent a configuration.

func (BuildConfig) Build

func (c BuildConfig) Build() ([]byte, error)

Build creates the config based on the template and the environment files.

type Changes

type Changes interface {
	Len() int
}

Changes is interface for changes.

type Storage

type Storage interface {
	String(format string) (string, error)
	GetChanges(config []byte, format, key string) (Changes, error)
	Diff(cs Changes, pretty bool) string
	Push(cs Changes) error
}

Storage is interface for storages.

Directories

Path Synopsis
cmd
Package consul contains helper functions for Consul storage.
Package consul contains helper functions for Consul storage.
Package diff is a utility to create visual diffs for key/value changes.
Package diff is a utility to create visual diffs for key/value changes.
storage

Jump to

Keyboard shortcuts

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