Documentation ¶
Index ¶
Constants ¶
View Source
const ( MySqlDbType string = "mysql" PostgresDbType string = "postgres" Sqlite3DbType string = "sqlite3" )
Database types
View Source
const ( EuroCentralBankDataSource string = "euro_central_bank" BankOfCanadaDataSource string = "bank_of_canada" ReserveBankOfAustraliaDataSource string = "reserve_bank_of_australia" CzechNationalBankDataSource string = "czech_national_bank" NationalBankOfPolandDataSource string = "national_bank_of_poland" )
Exchange rates data source types
View Source
const (
InternalUuidGeneratorType string = "internal"
)
Uuid generator types
Variables ¶
View Source
var (
Container = &ConfigContainer{}
)
Initialize a config container singleton instance
Functions ¶
func GetDefaultConfigFilePath ¶
GetDefaultConfigFilePath returns the defaule config file path
func SetCurrentConfig ¶
func SetCurrentConfig(config *Config)
SetCurrentConfig sets the current config by a given config
Types ¶
type Config ¶
type Config struct { // Global AppName string Mode SystemMode WorkingPath string // Server Protocol Scheme HttpAddr string HttpPort int Domain string RootUrl string CertFile string CertKeyFile string UnixSocketPath string StaticRootPath string EnableGZip bool EnableRequestLog bool // Database DatabaseConfig *DatabaseConfig EnableQueryLog bool AutoUpdateDatabase bool // Log LogModes []string EnableConsoleLog bool EnableFileLog bool LogLevel Level FileLogPath string // Uuid UuidGeneratorType string UuidServerId uint8 // Secret SecretKey string EnableTwoFactor bool TokenExpiredTime int TokenExpiredTimeDuration time.Duration TemporaryTokenExpiredTime int TemporaryTokenExpiredTimeDuration time.Duration EnableRequestIdHeader bool // User EnableUserRegister bool // Data EnableDataExport bool // Exchange Rates ExchangeRatesDataSource string ExchangeRatesRequestTimeout int }
Config represents the global setting config
func LoadConfiguration ¶
LoadConfiguration loads setting config from given config file path
type ConfigContainer ¶
type ConfigContainer struct {
Current *Config
}
ConfigContainer contains the current setting config
type DatabaseConfig ¶
type DatabaseConfig struct { DatabaseType string DatabaseHost string DatabaseName string DatabaseUser string DatabasePassword string DatabaseSSLMode string DatabasePath string MaxIdleConnection int MaxOpenConnection int ConnectionMaxLifeTime int }
DatabaseConfig represents the database setting config
type SystemMode ¶
type SystemMode string
SystemMode represents running mode of system
const ( MODE_DEVELOPMENT SystemMode = "development" MODE_PRODUCTION SystemMode = "production" )
System running modes
Click to show internal directories.
Click to hide internal directories.