config

package
v0.0.0-...-d437fa4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides the configuration methods for the wavepipe media server.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = []byte(`{
	"port": 8080,
	"mediaFolder": "",
	"sqlite": {
		"file": "~/.config/wavepipe/wavepipe.db"
	}
}`)

DefaultConfig is the default JSON configuration for wavepipe

View Source
var TravisConfig = []byte(`{
	"port": 8080,
	"mediaFolder": "/mem/",
	"sqlite": {
		"file": "~/.config/wavepipe/wavepipe.db"
	}
}`)

TravisConfig is the JSON configuration used for Travis builds

Functions

This section is empty.

Types

type Config

type Config struct {
	Port        int           `json:"port"`
	MediaFolder string        `json:"mediaFolder"`
	Sqlite      *SqliteConfig `json:"sqlite"`
}

Config represents the program configuration options

func (Config) Media

func (c Config) Media() string

Media returns the media folder from config, but with special characters such as '~' replaced

type ConfigSource

type ConfigSource interface {
	Load() (*Config, error)
	Use(string) error
}

ConfigSource represents the configuration source for the program

var C ConfigSource

C is the active configuration instance

type JSONFileConfig

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

JSONFileConfig represents configuration from a JSON configuration file

func (*JSONFileConfig) Load

func (c *JSONFileConfig) Load() (*Config, error)

Load returns the configuration from a JSON configuration file

func (*JSONFileConfig) Use

func (c *JSONFileConfig) Use(configPath string) error

Use sets the configuration file location for a JSON configuration file, attempting to create it if it does not exist

type SqliteConfig

type SqliteConfig struct {
	File string `json:"file"`
}

SqliteConfig represents configuration for an sqlite backend

Jump to

Keyboard shortcuts

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