config

package
v0.0.0-...-c118757 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(c *Config)

Set the Config

Types

type Config

type Config struct {
	Database   Database   `json:"database,omitempty"`
	Filesystem Filesystem `json:"filesystem,omitempty"`
	WebServer  WebServer  `json:"webserver,omitempty"`
}

Config struct holds configuration data

func CreateConfig

func CreateConfig(dbhost, dbname, dbusername, dbpassword, fstype, fspath, servehost, servepath string, serveport, dbport int) *Config

CreateConfig generates a configuration that can be saved

func Get

func Get() *Config

Get singleton instance of the Config

func LoadJSON

func LoadJSON(configfile string) (*Config, error)

LoadJSON loads configuration from a given json object

func (*Config) DumpJSON

func (c *Config) DumpJSON() ([]byte, error)

DumpJSON dumps json config

func (*Config) GetPublicPath

func (c *Config) GetPublicPath() string

GetPublicPath returns the public path under the web server

func (*Config) GetURL

func (c *Config) GetURL() string

GetURL returns the full URL of the web server

type Database

type Database struct {
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"`
	Database string `json:"dbname,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

Database configuration container

type Filesystem

type Filesystem struct {
	Type string `json:"type,omitempty"`
	Path string `json:"path,omitempty"`
}

Filesystem configuration container

type WebServer

type WebServer struct {
	Host string `json:"host,omitempty"`
	Path string `json:"servepath,omitempty"`
	Port int    `json:"serveport,omitempty"`
}

WebServer configuration container

Jump to

Keyboard shortcuts

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