config

package
v0.0.0-...-fc93c80 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name    string `env-required:"true" yaml:"name"    env:"APP_NAME"`
	Version string `env-required:"true" yaml:"version" env:"APP_VERSION"`
}

App 服务配置

type Config

type Config struct {
	App  `yaml:"app"`
	HTTP `yaml:"http"`
	Log  `yaml:"logger"`
	DB   `yaml:"db"`
	Oss  `yaml:"oss"`
}

Config 根结点

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns app config.

type DB

type DB struct {
	Username string `env-required:"true" yaml:"username" env:"DB_USERNAME"`
	Password string `env-required:"true" yaml:"password" env:"DB_PASSWORD"`
	Host     string `env-required:"true" yaml:"host" env:"DB_HOST"`
	Port     uint32 `env-required:"true" yaml:"port" env:"DB_PORT"`
	DbName   string `env-required:"true" yaml:"db_name" env:"DB_DB_NAME"`
	Timeout  string `env-required:"true" yaml:"timeout" env:"DB_TIMEOUT"`
}

DB 数据库配置

type HTTP

type HTTP struct {
	IP   string `env-required:"true" yaml:"ip" env:"HTTP_IP"`
	Port uint32 `env-required:"true" yaml:"port" env:"HTTP_PORT"`
}

HTTP http配置

type Log

type Log struct {
	Level string `env-required:"true" yaml:"log_level"   env:"LOG_LEVEL"`
}

Log 日志

type Oss

type Oss struct {
	BaseUrl string `env-required:"true" yaml:"base_url" env:"OSS_BaseUrl"`
}

Jump to

Keyboard shortcuts

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