Documentation
¶
Index ¶
- Variables
- func Db() *gorm.DB
- func InitDb(conf *Configuration) error
- func InitLogger(conf *Configuration) error
- func InitSettings(conf *Configuration, debug bool) error
- func IsDevelopmentMode() bool
- func IsProductionMode() bool
- func IsTestMode() bool
- func ReloadConfig()
- func SaveSettings()
- type AppMode
- type AppVersion
- type Configuration
- type SettingsConfiguration
Constants ¶
This section is empty.
Variables ¶
View Source
var Mode = AppMode(build.Mode)
View Source
var Version = AppVersion{ Commit: build.Commit, Version: build.Version, BuildDate: build.BuildDate, }
Functions ¶
func InitDb ¶ added in v0.0.6
func InitDb(conf *Configuration) error
func InitLogger ¶ added in v0.0.6
func InitLogger(conf *Configuration) error
func InitSettings ¶ added in v0.0.6
func InitSettings(conf *Configuration, debug bool) error
load settings from file
func IsDevelopmentMode ¶ added in v0.0.6
func IsDevelopmentMode() bool
func IsProductionMode ¶ added in v0.0.6
func IsProductionMode() bool
func IsTestMode ¶ added in v0.0.6
func IsTestMode() bool
func ReloadConfig ¶
func ReloadConfig()
func SaveSettings ¶ added in v0.0.6
func SaveSettings()
Types ¶
type AppVersion ¶ added in v0.0.6
type AppVersion struct {
Commit string `json:"commit"`
Version string `json:"version"`
BuildDate string `json:"build_date"`
}
Info holds build information
type Configuration ¶ added in v0.0.6
type Configuration struct {
Log struct {
Level string `koanf:"level" default:"info"`
TimeFormat string `koanf:"time_format" default:"2006-01-02 15:04:05.000"`
LogFile string `koanf:"log_file"`
AccessLog string `koanf:"access_log"`
} `koanf:"log" json:"log"`
Server struct {
ListenAddr string `koanf:"listen_addr" default:"0.0.0.0"`
Port int `koanf:"port" default:"9000"`
DataDir string `koanf:"data_dir"`
} `koanf:"app" json:"app"`
Db db.Config `koanf:"db" json:"db"`
}
configuration holds any kind of configuration that comes from the outside world and is necessary for running the application.
var (
Config *Configuration
)
func Cfg ¶
func Cfg() *Configuration
func InitConfig ¶ added in v0.0.6
func InitConfig(path string, debug bool) (*Configuration, error)
load config from file
type SettingsConfiguration ¶ added in v0.0.6
type SettingsConfiguration struct {
Test string `koanf:"test" default:"test"`
}
Settings holds any kind of configuration that can modify by admin web ui.
var (
Settings *SettingsConfiguration
)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.