feat(config): add redis url secret
This commit is contained in:
@@ -14,6 +14,7 @@ type Config struct {
|
||||
Server ServerConfig
|
||||
Logging LoggingConfig
|
||||
Database DatabaseConfig
|
||||
Redis RedisConfig
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -35,6 +36,14 @@ func (c DatabaseConfig) URL() (string, error) {
|
||||
return readSecretFile(c.URLFile)
|
||||
}
|
||||
|
||||
type RedisConfig struct {
|
||||
URLFile string
|
||||
}
|
||||
|
||||
func (c RedisConfig) URL() (string, error) {
|
||||
return readSecretFile(c.URLFile)
|
||||
}
|
||||
|
||||
func Load() Config {
|
||||
return Config{
|
||||
Server: ServerConfig{
|
||||
@@ -51,6 +60,10 @@ func Load() Config {
|
||||
Database: DatabaseConfig{
|
||||
URLFile: getEnv("DATABASE_URL_FILE", "/run/secrets/database_url"),
|
||||
},
|
||||
|
||||
Redis: RedisConfig{
|
||||
URLFile: getEnv("CACHE_URL_FILE", "/run/secrets/cache_url"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
package redis
|
||||
Reference in New Issue
Block a user