conf

package
v0.0.0-...-a2e4898 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stop = func() *stop {
	ctx, cancel := context.WithCancel(context.Background())
	return &stop{
		ctx:    ctx,
		cancel: cancel,
	}
}()

Stop is the global stop instance

Functions

func GetVersion

func GetVersion() http.HandlerFunc

GetVersion returns version as a simple json

func InitLogger

func InitLogger()

InitLogger loads a global logger based on Viper configuration

Types

type Config

type Config struct {
	Logger   LoggerConfig
	Pidfile  string
	Server   ServerConfig
	Database DatabaseConfig
}

Config represents the application's configuration

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

LoadConfig loads the configuration from the given file

func LoadDefaultConfig

func LoadDefaultConfig() *Config

LoadDefaultConfig loads the default configuration

type DatabaseConfig

type DatabaseConfig struct {
	Username            string
	Password            string
	Host                string
	Port                int
	Database            string
	Type                string
	AutoCreate          bool
	SearchPath          string
	SSLMode             string
	Retries             int
	SleepBetweenRetries string
	MaxConnections      int
	LogQueries          bool
	Path                string
}

DatabaseConfig represents the database's configuration

type LoggerConfig

type LoggerConfig struct {
	Level             string
	Encoding          string
	Color             bool
	DevMode           bool
	DisableCaller     bool
	DisableStacktrace bool
}

LoggerConfig represents the logger's configuration

type ServerConfig

type ServerConfig struct {
	Name           string
	Version        string
	Type           string
	RestHost       string
	RestPort       string
	UnixSocket     string
	DatetimeFormat string
	LogRequests    bool
}

ServerConfig represents the server's configuration

Jump to

Keyboard shortcuts

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