conf

package
v0.0.0-...-851e7b8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFilePath string = "configs"

ConfigFilePath is current directory that config file saved

Variables

This section is empty.

Functions

This section is empty.

Types

type Aliyun

type Aliyun struct {
	Available       bool   `yaml:"available"`
	AccessKeyID     string `yaml:"accessKeyID"`
	AccessKeySecret string `yaml:"accessKeySecret"`
	OSSEndpoint     string `yaml:"OSSEndpoint"`
	OSSBucketName   string `yaml:"OSSBucketName"`
	OSSCDN          string `yaml:"OSSCDN"`
}

Aliyun is defined for aliyun config model

type App

type App struct {
	Name        string   `yaml:"name"`
	Build       string   `yaml:"build"`
	Version     string   `yaml:"version"`
	Description string   `yaml:"description"`
	Scheme      string   `yaml:"scheme"`
	Host        string   `yaml:"host"`
	Base        string   `yaml:"base"`
	Locales     []string `yaml:"locales"`
}

App is defined for application bootstrap config model

type Config

type Config struct {
	App struct {
		Name        string   `yaml:"name" json:"name"`
		Build       string   `yaml:"build" json:"build"`
		Version     string   `yaml:"version" json:"version"`
		Description string   `yaml:"description" json:"description"`
		Scheme      string   `yaml:"scheme" json:"scheme"`
		Host        string   `yaml:"host" json:"host"`
		Base        string   `yaml:"base" json:"base"`
		Locales     []string `yaml:"locales" json:"locales"`
	}

	MiddleWares struct {
		FallbackLocale string `yaml:"fallbackLocale"`
		Gzip           bool   `yaml:"gzip"`
		LimitRate      int    `yaml:"limitRate"`
		Log            bool   `yaml:"log"`
		Dump           bool   `yaml:"dump"`
		CORS           bool   `yaml:"CORS"`
	}

	Jwt struct {
		Key    string        `yaml:"key"`
		Expire time.Duration `yaml:"expire"`
	}

	DB struct {
		Driver string `yaml:"driver"`
		DSN    string `yaml:"dsn"`
	}

	Redis struct {
		Host         string        `yaml:"host"`
		DB           int           `yaml:"db"`
		Port         int           `yaml:"port"`
		Password     string        `yaml:"password"`
		IdleTimeout  time.Duration `yaml:"idleTimeout"`
		ReadTimeout  time.Duration `yaml:"readTimeout"`
		WriteTimeout time.Duration `yaml:"writeTimeout"`
		PoolTimeout  time.Duration `yaml:"poolTimeout"`
	}

	SMTP struct {
		Host     string `yaml:"host"`
		Port     int    `yaml:"port"`
		Password string `yaml:"password"`
		Username string `yaml:"username"`
		TestRcpt string `yaml:"testRcpt"`
	}

	Aliyun struct {
		Available       bool   `yaml:"available"`
		AccessKeyID     string `yaml:"accessKeyID"`
		AccessKeySecret string `yaml:"accessKeySecret"`
		OSSEndpoint     string `yaml:"OSSEndpoint"`
		OSSBucketName   string `yaml:"OSSBucketName"`
		OSSCDN          string `yaml:"OSSCDN"`
	}
}

Config model

func (*Config) GetBootstrapConfig

func (c *Config) GetBootstrapConfig() (*Config, error)

GetBootstrapConfig is defined for get config from current files 根据环境配置返回app配置信息 app配置信息分别存储在development.yaml或production.yaml中 开发配置的信息和生产的将分开

func (*Config) GetEnv

func (c *Config) GetEnv() string

GetEnv is defined for get environment string 获取env.yaml中的配置项目 env.yaml 中包含环境信息,如果返回development则说明是开发模式

具体配置信息根据env.yaml中配置的而定论

type DB

type DB struct {
	Driver string `yaml:"driver"`
	DSN    string `yaml:"dsn"`
}

DB is defined for database config model

type Jwt

type Jwt struct {
	Key    string        `yaml:"key"`
	Expire time.Duration `yaml:"expire"`
}

Jwt is defined for json web token config model

type MiddleWares

type MiddleWares struct {
	FallbackLocale string `yaml:"fallbackLocale"`
	Gzip           bool   `yaml:"gzip"`
	LimitRate      int    `yaml:"limitRate"`
	Log            bool   `yaml:"log"`
	Dump           bool   `yaml:"dump"`
	CORS           bool   `yaml:"CORS"`
}

MiddleWares is defined for middleWares config model

type Redis

type Redis struct {
	Host         string        `yaml:"host"`
	DB           int           `yaml:"db"`
	Port         int           `yaml:"port"`
	Password     string        `yaml:"password"`
	IdleTimeout  time.Duration `yaml:"idleTimeout"`
	ReadTimeout  time.Duration `yaml:"readTimeout"`
	WriteTimeout time.Duration `yaml:"writeTimeout"`
	PoolTimeout  time.Duration `yaml:"poolTimeout"`
}

Redis is defined for redis config model

type SMSConfig

type SMSConfig struct {
	API            string   `yaml:"api" json:"-"`
	Account        string   `yaml:"account" json:"-"`
	Password       string   `yaml:"password" json:"-"`
	Sign           string   `yaml:"sign" json:"-"`
	CreateAccount  string   `yaml:"createAccount" json:"-"`
	ModifyPassword string   `yaml:"modifyPassword" json:"-"`
	Login          string   `yaml:"login" json:"-"`
	Common         string   `yaml:"common" json:"-"`
	Actions        []string `yaml:"actions" json:"actions"`
}

SMSConfig is defined for sms api and templates config model

type SMTP

type SMTP struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	Username string `yaml:"username"`
	TestRcpt string `yaml:"testRcpt"`
}

SMTP server configrations

Jump to

Keyboard shortcuts

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