Skip to content
Simple, painless, zero-config configuration storage
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
README.md
store.go
store_test.go

README.md

Store

Build Status Coverage Status Go Report Card GoDoc

Simple, painless, zero-config configuration storage

Installation

go get -u github.com/atrox/store
# or with dep
dep ensure -add github.com/atrox/store

Example

package main

import (
	"fmt"

	"github.com/atrox/store"
)

type Config struct {
	Name string `yaml:"name"`
	Age  int    `yaml:"age"`
}

func main() {
	storage, err := store.New("testapp")
	if err != nil {
		panic(err)
	}

	config := &Config{
		Name: "Dr. Robert Ford",
		Age:  70,
	}
	err = storage.Save(config)
	if err != nil {
		panic(err)
	}
	fmt.Printf("config is now saved at %s\n", storage.Path(config))
	// ~/.config/testapp/config.yaml

	config = &Config{}
	err = storage.Get(config)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Config retrieved:\n%+v\n", config)
	// &{Name:Dr. Robert Ford Age:70}
}

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

You can’t perform that action at this time.