config

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFile = "./config.yml"
	// App
	DefaultTitle      = "teamlint"
	DefaultCopyright  = "teamlint.com"
	DefaultTimeFormat = "2006-01-02 15:04:05"
	DefaultCharset    = "UTF-8"
	// Server
	DefaultServerHTTPAddr     = ":1234"
	DefaultServerReadTimeout  = "5s"
	DefaultServerWriteTimeout = "10s"
	DefaultServerIdleTimeout  = "15s"
	// Databases
	DefaultDatabaseDriverName      = "postgres"
	DefaultDatabaseConnString      = "postgres://postgres:postgres@localhost/ardan?sslmode=disable"
	DefaultDatabaseConnMaxLifetime = "3m"
	DefaultDatabaseMaxOpenConns    = 300
	DefaultDatabaseMaxIdleConns    = 10
	DefaultDatabaseLog             = false
)

Variables

This section is empty.

Functions

func App

func App() *section.App

App 应用程序配置

func Caches

func Caches(name string) *section.Cache

Caches 缓存配置

func Config

func Config(opts ...Option) *section.Config

Config 配置

func Databases

func Databases(name string) *section.Database

Databases 数据库配置

func Get

func Get(path ...string) reader.Value

Get 获取指定路径配置

func Load added in v0.2.1

func Load(source ...source.Source) error

Load config sources

func LoadFile added in v0.2.1

func LoadFile(path string) error

LoadFile 加载配置文件

func Map

func Map() map[string]interface{}

Map 获取配置字典

func Server

func Server() *section.Server

Server 服务器配置

Types

type Option

type Option func(conf *section.Config)

func WithCharset

func WithCharset(charset string) Option

WithCharset 字符集

func WithHTTPAddr added in v0.2.1

func WithHTTPAddr(addr string) Option

WithHTTPAddr Http服务地址

func WithTitle

func WithTitle(title string) Option

WithTitle 应用标题

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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