config

package
v0.0.0-...-50f4c6c Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func GetDB

func GetDB() *gorm.DB

func Setup

func Setup(configPath string)

SetupDB initialize configuration

func SetupDB

func SetupDB()

SetupDB opens a database and saves the reference to `Database` struct.

Types

type Configuration

type Configuration struct {
	Server   ServerConfiguration
	Database DatabaseConfiguration
}
var Config *Configuration

func GetConfig

func GetConfig() *Configuration

GetConfig helps you to get configuration data

type Database

type Database struct {
	*gorm.DB
}

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Driver       string
	Dbname       string
	Username     string
	Password     string
	Host         string
	Port         string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
}

type ServerConfiguration

type ServerConfiguration struct {
	Port   string
	Secret string
	Mode   string
}

Jump to

Keyboard shortcuts

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