env

package
v1.0.31-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBanner

func InitBanner()

func InitCors

func InitCors(cors *Cors) gin.HandlerFunc

func InitDatabase

func InitDatabase(c *Conf)

func InitLog

func InitLog()

func InitServer

func InitServer(c *Conf, route func(r gin.IRouter), t time.Time)

Types

type Conf

type Conf struct {
	Profile    string       `yaml:"profile"`
	Server     Server       `yaml:"server"`
	Datasource []Datasource `yaml:"datasource"`
}

func Load

func Load() *Conf

load、parse、merge configuration file

type Cors

type Cors struct {
	Enable           bool   `yaml:"enable"`
	AllowOrigin      string `yaml:"allow-origin"`
	AllowMethods     string `yaml:"allow-methods"`
	AllowHeaders     string `yaml:"allow-headers"`
	AllowCredentials string `yaml:"allow-credentials"`
	ExposeHeaders    string `yaml:"expose-headers"`
	MaxAge           string `yaml:"max-age"`
}

type Datasource

type Datasource struct {
	Name     string `yaml:"name"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Database string `yaml:"database"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Server

type Server struct {
	Port        int    `yaml:"port"`
	ContextPath string `yaml:"context-path"`
	Cors        Cors   `yaml:"cors"`
}

Jump to

Keyboard shortcuts

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