config

package
v0.0.0-...-9ce97eb Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvProduction は本番環境を示す環境変数値.
	EnvProduction = "production"

	// EnvTesting は検証環境を示す環境変数値.
	EnvTesting = "testing"

	// EnvDevelopment は開発環境を示す環境変数値.
	EnvDevelopment = "development"

	// EnvLocal はローカル環境を示す環境変数値.
	EnvLocal = "local"
)
View Source
const (
	// LogLevelDebug はデバッグ情報を出力させるための設定値.
	LogLevelDebug = "debug"

	// LogLevelInfo は情報を出力させるための設定値.
	LogLevelInfo = "info"

	// LogLevelWarning は警告情報を出力させるための設定値.
	LogLevelWarning = "warning"

	// LogLevelError はエラー情報を出力させるための設定値.
	LogLevelError = "error"

	// LogLevelFatal は致命的なエラー情報を出力させるための設定値.
	LogLevelFatal = "fatal"
)
View Source
const AllowedMinPort uint16 = 1024

AllowedMinPort はウェルノウンポート( 0-1023 )を 使用させないようにするために指定するポート番号の最低値.

Variables

View Source
var Revision = "latest"

Revision is the value of commit hash embed on build.

Revision はビルド時に埋め込まれるコミットハッシュの値.

View Source
var Version = "edge"

Version is the value of release tag embed on build.

Version はビルド時に埋め込まれるリリースタグの値.

Functions

This section is empty.

Types

type Config

type Config struct {
	App struct {
		Env        string `yaml:"env"`
		ListenPort uint16 `yaml:"listen_port"`
		LogLevel   string `yaml:"log_level"`
	} `yaml:"app"`
	Cache struct {
		Redis struct {
			Host     string `yaml:"host"`
			Password string `yaml:"password"`
			Port     uint16 `yaml:"port"`
		} `yaml:"redis"`
	} `yaml:"cache"`
	Database struct {
		Connection struct {
			LifeTimeSeconds uint `yaml:"life_time_seconds"`
			MaxIdle         uint `yaml:"max_idle"`
			MaxOpen         uint `yaml:"max_open"`
		} `yaml:"connection"`
		Logging bool `yaml:"logging"`
		MySQL   struct {
			Charset   string `yaml:"charset"`
			Database  string `yaml:"database"`
			HostRead  string `yaml:"host_read"`
			HostWrite string `yaml:"host_write"`
			Password  string `yaml:"password"`
			Port      uint16 `yaml:"port"`
			Timezone  string `yaml:"timezone"`
			Username  string `yaml:"username"`
		} `yaml:"mysql"`
	} `yaml:"database"`
	HTTP struct {
		DefaultTimeoutSeconds uint8  `yaml:"default_timeout_seconds"`
		Proxy                 string `yaml:"proxy"`
	} `yaml:"http"`
	Lang struct {
		Fallback       string `yaml:"fallback"`
		HTTPHeaderName string `yaml:"http_header_name"`
	} `yaml:"lang"`
}

Config is generated by https://zhwt.github.io/yaml-to-go/

func Load

func Load() (*Config, error)

func (*Config) Dump

func (c *Config) Dump() string

Jump to

Keyboard shortcuts

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