env

package
v1.0.13-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitCors

func InitCors(cors *Cors) gin.HandlerFunc

func InitDatabase

func InitDatabase(c *Conf)

func InitServer

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

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 {
	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:"InitCors"`
}

Jump to

Keyboard shortcuts

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