package
0.0.0-20241018081110-072913901059
Repository: https://github.com/oldmacloud/crud.git
Documentation: pkg.go.dev
# Functions
FromEnv reads config from environment variables, and unmarshal to config prefix is the prefix of environment variables: type MyConfig struct { Foo struct { Bar string } } config := MyConfig{} config.Init(&config, FromEnv("MYAPP")) will read `config.Foo.Bar` from env `MYAPP_FOO_BAR`.
FromFile reads config from file at path, and unmarshal to config.
Init reads configure, write values into given configModel - FromFile: read config from file - FromEnv: read config from environment variables - WatchFileChange: watch config file and reload config when changed.
WatchFileChange works with FromFile: var config MyConfig config.Init(&config, FromFile(path), WatchFileChange(hook))
WatchFileChange watch current viper config file, and reload config when changed.
# Variables
No description provided by the author
# Structs
BaseConfig includes common config for services.
DBConfig is the configurations for connecting database.
HTTPConfig is the configurations for HTTP server.
# Type aliases
No description provided by the author