simpleconffile

package module
v0.0.0-...-933aea6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 10 Imported by: 1

README

simpleconffile

Basic save/read struct as a json for a configuration file - with simple encrypt abilities

Documentation

Overview

simpleconffile package

This is not the intended to be a high class way of storing off a config file, let alone encrypt the contents. However, for simple tools, it is a great lift.

Allows one to quickly write a struct into a conf file and read back.

Also if wanted - encrypt strings so a someone cannot read them in the exported conf file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleConfFile

type SimpleConfFile struct {
	ByteEncryptKey []byte // holds the key for the crypto work
	Filename       string // name of the file to write/read

}

func New

func New(keystring string, confname string) *SimpleConfFile

func (*SimpleConfFile) DecryptString

func (pS *SimpleConfFile) DecryptString(cryptoText string) string

DecryptString() - Decrypts a string

text - string to decrypt

addapted from https://gist.github.com/manishtpatel/8222606

encrypt string to base64 crypto using AES

func (*SimpleConfFile) Dump

func (pS *SimpleConfFile) Dump()

func (*SimpleConfFile) EncryptString

func (pS *SimpleConfFile) EncryptString(text string) string

func (*SimpleConfFile) GetEncryptKey

func (pS *SimpleConfFile) GetEncryptKey() []byte

func (*SimpleConfFile) ReadConf

func (pS *SimpleConfFile) ReadConf(v interface{}) bool

func (*SimpleConfFile) SaveConf

func (pS *SimpleConfFile) SaveConf(v interface{}) bool

func (*SimpleConfFile) SetEncryptKey

func (pS *SimpleConfFile) SetEncryptKey(input string)

Jump to

Keyboard shortcuts

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