config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StageDev development environment.
	StageDev = "development"
	// StageTest test environment.
	StageTest = "test"
	// StageStaging staging environment.
	StageStaging = "staging"
	// StageProd production environment.
	StageProd = "production"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name      string `yaml:"name"`
	Version   string `yaml:"version"`
	Stage     string `yaml:"stage"`
	SecretKey string `yaml:"secret-key"`

	HTTP HTTPConfig `yaml:"http"`

	App interface{} `yaml:"app"`
}

Config configuration.

var G *Config

G global config instance

func (*Config) IsDevelopment

func (c *Config) IsDevelopment() bool

IsDevelopment returns true if current stage is development.

func (*Config) UnmarshalApp

func (c *Config) UnmarshalApp(outPtr interface{}) error

UnmarshalApp configuration to out.

type HTTPConfig

type HTTPConfig struct {
	Listen              string `yaml:"listen"`
	ReadHeaderTimeoutMS uint32 `yaml:"read-header-timeout-ms"`
	ReadTimeoutMS       uint32 `yaml:"read-timeout-ms"`
	WriteTimeoutMS      uint32 `yaml:"write-timeout-ms"`

	CookieMaxAge int `yaml:"cookie-max-age"`
}

HTTPConfig configuration of HTTP

func (*HTTPConfig) ListenAddr

func (hc *HTTPConfig) ListenAddr() string

func (*HTTPConfig) Timeouts

func (hc *HTTPConfig) Timeouts() (time.Duration, time.Duration, time.Duration)

type Option

type Option struct {
	Reader io.ReadCloser
}

Option that provide by applications

Jump to

Keyboard shortcuts

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