config

package
v0.0.0-...-abdde1b Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APP

type APP struct {
	Version string
}

APP holds general app configuration values

type Config

type Config struct {
	APP      APP
	Server   Server
	Database Database
	Logger   Logger
	Token    Token
}

Config object

func New

func New(name string, path ...string) (*Config, error)

New returns a new config, by default it looks for config files in the current working directory, if your config is locate somewhere path the path as second argument

type Database

type Database struct {
	Host         string
	Port         int16
	Username     string
	Password     string
	Database     string
	MaxIdleConns int
	MaxOpenConns int
}

Database holds the base configuration for the application db storage

type Logger

type Logger struct {
	LogLevel     uint8
	EnableStdout bool
	ReportCaller bool
	AppVersion   string
}

Logger holds the configuration for logging

type Server

type Server struct {
	Scheme       string
	Host         string
	Port         int
	ReadTimeout  int64
	WriteTimeout int64
	IdleTimeout  int64
}

Server holds the base configuration for the http server ReadTimeout is the maximum duration for reading the entire request, including the body (seconds) WriteTimeout is the maximum duration before timing out writes the response (seconds) IdleTimeout is the maximum amount of time to wait for the next request when keep-alive is enabled (seconds)

type Token

type Token struct {
	Secret string
	TTL    int64 // Minutes
}

Token holds configuration for tokens

Jump to

Keyboard shortcuts

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