feat(config): add redis url secret

This commit is contained in:
kk10
2026-10-06 13:18:46 +03:00
parent 06e9af1ba6
commit f7e1866d4e
4 changed files with 18 additions and 2 deletions
+13
View File
@@ -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"),
},
}
}
+1
View File
@@ -0,0 +1 @@
package redis