config

package
v0.0.0-...-8df1a9e Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_HTTP_PORT         int64  = 8080
	DEFAULT_DATABASE_ENGINE   string = "bolt"
	DEFAULT_DATABASE_DATABASE string = ""
	DEFAULT_DATABASE_PASSWORD string = ""
	DEFAULT_DATABASE_USERNAME string = ""
	DEFAULT_DATABASE_HOST     string = ""
	DEFAULT_DATABASE_PORT     int64  = 0
	DEFAULT_DATABASE_FILE     string = "db.bolt"
)

Variables

View Source
var (
	HTTP_PORT         = DEFAULT_HTTP_PORT
	DATABASE_ENGINE   = DEFAULT_DATABASE_ENGINE
	DATABASE_DATABASE = DEFAULT_DATABASE_DATABASE
	DATABASE_PASSWORD = DEFAULT_DATABASE_PASSWORD
	DATABASE_USERNAME = DEFAULT_DATABASE_USERNAME
	DATABASE_HOST     = DEFAULT_DATABASE_HOST
	DATABASE_PORT     = DEFAULT_DATABASE_PORT
	DATABASE_FILE     = DEFAULT_DATABASE_FILE
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Server   ServerConfiguration   `toml:"server"`
	Database DatabaseConfiguration `toml:"database"`
}

func New

func New() Configuration

func Open

func Open(file string) (Configuration, error)

func (*Configuration) Fetch

func (self *Configuration) Fetch(file string) error

func (Configuration) Marshal

func (self Configuration) Marshal() (string, error)

func (*Configuration) Save

func (self *Configuration) Save(file string) error

func (*Configuration) Unmarshal

func (self *Configuration) Unmarshal(data string) error

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Type     string `toml:"type"`
	Database string `toml:"database"`
	Password string `toml:"password"`
	Username string `toml:"username"`
	Host     string `toml:"host"`
	Port     int64  `toml:"port"`
	File     string `toml:"file"`
}

func (*DatabaseConfiguration) GetDatabaseConnectionString

func (self *DatabaseConfiguration) GetDatabaseConnectionString() (string, error)

type ServerConfiguration

type ServerConfiguration struct {
	// Host
	Port int64 `toml:"port"`
}

Jump to

Keyboard shortcuts

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