config

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

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

Go to latest
Published: Jun 17, 2017 License: MIT Imports: 13 Imported by: 0

README

ahmdrz/config

In-App simple configuration manager with AES encryption for Go applications.

Usage

    // Create configuration manager
    // with AES key and application name
    cfg, err := config.New([]byte("E3A15379B331C825"), "my_application")
    if err != nil {
	// handle error , occurred because key size is invalid.
    }

    // Let's save a struct , for example testStruct
    err = cfg.Save("test.cfg", testStruct)
    if err != nil {
    	panic(err)
    }

    // Now take a look to your .config or %APPDATA% ...
    // you will see a directory with your application name.

    // It's time to load our encrypted configuration into testStruct
    err = cfg.Load("test.cfg", &testStruct)
    if err != nil {
	panic(err)
    }

    // Do you want to remove all of configurations ?
    err = cfg.Remove()

TODO

  • Create another New method for RSA with public/private key.
  • Using alexflint/go-memdump instead of GOB encoding method.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func New

func New(key []byte, configName string) (*Config, error)

func (*Config) Load

func (c *Config) Load(fileName string, object interface{}) error

func (*Config) Remove

func (c *Config) Remove() error

func (*Config) Save

func (c *Config) Save(fileName string, object interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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