config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltConfig

type BoltConfig struct {
	// file path for database file
	Path string `envconfig:"database_path_bolt" default:"/tmp/go.db"`
}

BoltConfig represents a on-disk key/value store https://github.com/boltdb/bolt

type Config

type Config struct {
	Debug       bool   `envconfig:"debug" default:"false"`
	LogLevel    string `envconfig:"loglevel" default:"info"`
	Host        string `envconfig:"host" default:"localhost:8080"`
	MaxIDLength int    `envconfig:"max_id_length" default:"50"` // The total amount of characters that a short name can be
	Database    *DatabaseConfig
}

Config refers to general application configuration

func FromEnv

func FromEnv() (*Config, error)

FromEnv pulls configration from environment variables

type DatabaseConfig

type DatabaseConfig struct {
	// The database engine used by the backend
	// possible values are: bolt, redis
	Engine string `envconfig:"database_engine" default:"bolt"`
	Bolt   *BoltConfig
	Redis  *RedisConfig
}

DatabaseConfig defines config settings for comet database

type RedisConfig

type RedisConfig struct {
	Host     string `envconfig:"database_host_redis" default:"localhost:6379"`
	Password string `envconfig:"database_password_redis"`
	DB       int    `envconfig:"database_db_redis" default:"0"` // redis database number 0-15
}

RedisConfig represents a key/value store https://redis.io

Jump to

Keyboard shortcuts

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