configuration

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package configuration handles modifying, saving, and outputting the configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	MailDropEmail string `json:"mailDropEmail"`
	GmailUsername string `json:"gmailUsername"`
	GmailPassword string `json:"gmailPassword"`
}

Configuration represents the fields in the configuration file.

func (*Configuration) Create added in v0.2.1

func (config *Configuration) Create(filePath string) (bool, error)

Create is what creates the configuration file.

func (*Configuration) GetConfigDirPath

func (config *Configuration) GetConfigDirPath() (string, error)

GetConfigDirPath retrieves the absolute path to the configuration directory in an OS independent way.

The configuration folder is at `~/.of`. If an error occurs, an empty string is returned as the path.

func (*Configuration) GetConfigFilePath

func (config *Configuration) GetConfigFilePath() (string, error)

GetConfigFilePath retrieves the absolute path to the configuration file in an OS independent way.

The configuration file is at `~/.of/config.json`. If an error occurs, an empty string is returned as the path.

func (*Configuration) Init

func (config *Configuration) Init() error

Init initializes the configuration file by creating the configuration folder at ~/.of/ and configuration file at ~/.of/config.json. It only creates these if they do not exist.

It is intended to be run when the application starts up to make sure that the config directory and file is created.

func (*Configuration) Output

func (config *Configuration) Output() error

Output outputs the configuration file to stdout.

func (*Configuration) Parse

func (config *Configuration) Parse() error

Parse parses the configuration file from `~/.of/config.json` and reads the fields into this Configuration.

func (*Configuration) Save

func (config *Configuration) Save() error

Save saves the current state of this Configuration to `~/.of/config.json`.

Jump to

Keyboard shortcuts

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