config

package
v0.0.0-...-b90bf7d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config manages everything related to the config file of a running host instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PID     string `json:"pid,omitempty"`
	HostKey string `json:"host_key,omitempty"`
	Home    string `json:"home,omitempty"`
	DbID    string `json:"db_id,omitempty"`
	DbPass  string `json:"db_pass,omitempty"`
	File    string `json:"-"`
}

Config holds all information about a running host instance.

func Ensure

func Ensure(path, key, home string) (*Config, error)

Ensure opens and writes a config file in exclusive mode ensuring that only one host instance is running.

func New

func New() *Config

New creates new Config.

func Open

func Open(file string) (*Config, error)

Open parses config file at specifided location.

func Parse

func Parse(r io.Reader) (*Config, error)

Parse decodes the json encoded the config file.

func (*Config) Cleanup

func (c *Config) Cleanup() error

Cleanup removes config file of current instance.

func (*Config) EnsurePaths

func (c *Config) EnsurePaths(path string) error

EnsurePaths ensures that all paths necessary for proper host functioning exist.

func (*Config) Write

func (c *Config) Write() error

Write serializes and writes current configuration atomically.

Jump to

Keyboard shortcuts

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