backends

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2017 License: MIT Imports: 13 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ConfigTypeFile = "file"
	ConfigTypeS3   = "s3"
	ConfigTypeMock = "mock"
)

Variables

This section is empty.

Functions

func NewMockBackend added in v0.3.0

func NewMockBackend() *mockBackend

Types

type Client added in v0.3.0

type Client interface {
	Load() ([]byte, error)
	Save([]byte) error
	Backup() error
	SafeLocation() string
}

func New added in v0.3.0

func New(config *Config) (Client, error)

type Config added in v0.3.0

type Config struct {
	Type     string                 `toml:"type"`
	Backup   backupConfig           `toml:"backup"`
	Settings map[string]interface{} `toml:"settings"`
}

func NewDefaultConfig added in v0.3.0

func NewDefaultConfig() Config

type DiskBackend

type DiskBackend struct {
	// contains filtered or unexported fields
}

func NewDiskBackend

func NewDiskBackend(config Config) (*DiskBackend, error)

func (*DiskBackend) Backup added in v0.3.0

func (db *DiskBackend) Backup() error

func (*DiskBackend) Load

func (db *DiskBackend) Load() ([]byte, error)

func (*DiskBackend) SafeLocation added in v0.4.0

func (db *DiskBackend) SafeLocation() string

func (*DiskBackend) Save

func (db *DiskBackend) Save(data []byte) error

type S3Backend added in v0.5.0

type S3Backend struct {
	Bucket string
	Key    string
	// contains filtered or unexported fields
}

S3Backend provides AWS S3 backed safe storage

This implementation relies on AWS Credentials in `~/.aws/credentials` for authentication. If AWS_PROFILE is not set, "default" will be used.

The following environment variables are required:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION

func NewS3Backend added in v0.5.0

func NewS3Backend(config Config) (*S3Backend, error)

NewS3Backend returns a new S3 Backend implementation.

The following config settings are supported:

region:  AWS Region to use
profile: AWS Profile in ~/.aws/credentials to use
bucket:	 AWS S3 Bucket name for storing the safe. Defaults to `defaultS3Bucket`
key:	 	 AWS S3 Key name for storing the safe. Defaults to `defaultS3Key`

func (*S3Backend) Backup added in v0.5.0

func (s *S3Backend) Backup() error

Backup creates a backup of the current safe

func (*S3Backend) Load added in v0.5.0

func (s *S3Backend) Load() ([]byte, error)

Load loads data from S3

func (*S3Backend) SafeLocation added in v0.5.0

func (s *S3Backend) SafeLocation() string

SafeLocation return the path to the current safe

func (*S3Backend) Save added in v0.5.0

func (s *S3Backend) Save(data []byte) error

Save writes data to S3

Jump to

Keyboard shortcuts

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