Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyDBUserOrPassword represents the 'user' or 'password' empty error ErrEmptyDBUserOrPassword = errors.New("database 'User' or 'Password' should not be empty") // ErrEmptyDBName represents the 'name' empty error ErrEmptyDBName = errors.New("database 'Name' should not be empty") // ErrEmptyDBServer represents the 'database server' empty error ErrEmptyDBServer = errors.New("database 'Server' should not be empty") // ErrNonStorageBackend represents the 'storage backend' empty error ErrNonStorageBackend = errors.New("at least one storage backend required") // ErrNonSessionBackend represents the 'session backend' empty error ErrNonSessionBackend = errors.New("at least one session backend required") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Port is the server listen port Port int64 `yaml:"port"` // Log defines the log config group // The log validation will be checked in the log init part. Log LogConfig `yaml:"log,omitempty"` // StorageLoad // 'dynamic' or 'static' // static: load at the first time // dynamic: load every time, most time because of multiple tenant using their own token/ak-sk // TODO: should have 'default' value StorageLoad string `yaml:"storageload,omitempty"` // Storage defines the storage config group Storage StorageConfig `yaml:"storage"` // DB defines the db config group DB DBConfig `yaml:"db"` // Session defines the session config group Session SessionConfig `yaml:"session"` }
Config defines the config items
func InitConfigFromFile ¶
InitConfigFromFile loads the config from a file
type DBConfig ¶
type DBConfig struct { Driver string `yaml:"driver"` User string `yaml:"user"` Password string `yaml:"password"` Server string `yaml:"server"` Name string `yaml:"name"` }
DBConfig defines the db configs
func (*DBConfig) GetConnection ¶
GetConnection returns the sql recognizable connection string
type SessionConfig ¶
SessionConfig stores the session config item group
func (*SessionConfig) Valid ¶
func (cfg *SessionConfig) Valid() error
Valid checks the session config validation
type StorageConfig ¶
StorageConfig stores the storage config item group
func (*StorageConfig) Valid ¶
func (cfg *StorageConfig) Valid() error
Valid checks the storage config validation
Click to show internal directories.
Click to hide internal directories.