config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2017 Elliott Polk. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2017 Elliott Polk. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

View Source
const DefaultEnv = "default"

Variables

This section is empty.

Functions

func Remove

func Remove(app, env string) error

Remove attempts to delete relevant config for the provided app name. If no config exists, no error is returned.

Types

type Config

type Config struct {
	App         string `json:"app"`
	Environment string `json:"environment"`
	Value       string `json:"config"`
}

func Find

func Find(app, env string) []*Config

func NewConfig

func NewConfig(raw string) (*Config, error)

func (*Config) Decrypt

func (cfg *Config) Decrypt(t string) error

Decrypt will take the provided token and attempt to decrypt the config.Value. No additional processing on the token will occur.

func (*Config) Encrypt

func (cfg *Config) Encrypt(t string) (string, error)

Encrypt will take the provided token, convert it to a base64 string, attempt to encrypt the config.Value, and return the final version of the token used for encryption. If no token is provided, a UUID (v4) will be generated.

func (*Config) MustString

func (cfg *Config) MustString() string

func (*Config) Save

func (c *Config) Save() error

Save adds the config value to the datastore using the app name as the key

func (*Config) String

func (cfg *Config) String() (string, error)

Jump to

Keyboard shortcuts

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