···
"github.com/sethvargo/go-envconfig"
···
Endpoint string `env:"ENDPOINT, default=https://eu.i.posthog.com"`
Core CoreConfig `env:",prefix=TANGLED_"`
Jetstream JetstreamConfig `env:",prefix=TANGLED_JETSTREAM_"`
···
Camo CamoConfig `env:",prefix=TANGLED_CAMO_"`
Avatar AvatarConfig `env:",prefix=TANGLED_AVATAR_"`
OAuth OAuthConfig `env:",prefix=TANGLED_OAUTH_"`
func LoadConfig(ctx context.Context) (*Config, error) {
···
"github.com/sethvargo/go-envconfig"
···
Endpoint string `env:"ENDPOINT, default=https://eu.i.posthog.com"`
+
type RedisConfig struct {
+
Addr string `env:"ADDR, default=localhost:6379"`
+
Password string `env:"PASS"`
+
DB int `env:"DB, default=0"`
+
func (cfg RedisConfig) ToURL() string {
+
Path: fmt.Sprintf("/%d", cfg.DB),
+
if cfg.Password != "" {
+
u.User = url.UserPassword("", cfg.Password)
Core CoreConfig `env:",prefix=TANGLED_"`
Jetstream JetstreamConfig `env:",prefix=TANGLED_JETSTREAM_"`
···
Camo CamoConfig `env:",prefix=TANGLED_CAMO_"`
Avatar AvatarConfig `env:",prefix=TANGLED_AVATAR_"`
OAuth OAuthConfig `env:",prefix=TANGLED_OAUTH_"`
+
Redis RedisConfig `env:",prefix=TANGLED_REDIS_"`
func LoadConfig(ctx context.Context) (*Config, error) {