Added redis integration.
This commit is contained in:
parent
5e384c8a4e
commit
bccb538d19
5 changed files with 72 additions and 5 deletions
|
|
@ -18,14 +18,15 @@ const (
|
|||
|
||||
// Config stores complete application configuration
|
||||
type Config struct {
|
||||
HTTP HTTPConfig
|
||||
App AppConfig
|
||||
HTTP HTTPConfig
|
||||
App AppConfig
|
||||
Cache CacheConfig
|
||||
}
|
||||
|
||||
// HTTPConfig stores HTTP configuration
|
||||
type HTTPConfig struct {
|
||||
Hostname string `env:"HTTP_HOSTNAME"`
|
||||
Port uint16 `env:"HTTP_PORT,default=8081"`
|
||||
Port uint16 `env:"HTTP_PORT,default=8000"`
|
||||
ReadTimeout time.Duration `env:"HTTP_READ_TIMEOUT,default=5s"`
|
||||
WriteTimeout time.Duration `env:"HTTP_WRITE_TIMEOUT,default=10s"`
|
||||
IdleTimeout time.Duration `env:"HTTP_IDLE_TIMEOUT,default=2m"`
|
||||
|
|
@ -38,6 +39,12 @@ type AppConfig struct {
|
|||
EncryptionKey string `env:"APP_ENCRYPTION_KEY,default=?E(G+KbPeShVmYq3t6w9z$C&F)J@McQf"`
|
||||
}
|
||||
|
||||
type CacheConfig struct {
|
||||
Hostname string `env:"CACHE_HOSTNAME,default=localhost"`
|
||||
Port uint16 `env:"CACHE_PORT,default=6379"`
|
||||
Password string `env:"CACHE_PASSWORD"`
|
||||
}
|
||||
|
||||
// GetConfig loads and returns application configuration
|
||||
func GetConfig() (Config, error) {
|
||||
var cfg Config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue