gsn-proxy/internal/repository/config.go
2025-03-26 17:14:00 +03:00

23 lines
445 B
Go

package repository
import (
"fmt"
env "github.com/caarlos0/env/v11"
)
type Config struct {
ConnStr string `env:"CONNSTR" envDefault:"postgres://gsn:gsn@localhost:5432/gsn?sslmode=disable"`
}
func NewConfig(servicePrefix string) (*Config, error) {
cfg := &Config{}
if err := env.ParseWithOptions(cfg, env.Options{
PrefixTagName: fmt.Sprintf("%s_REPOSITORY_", servicePrefix),
}); err != nil {
return nil, err
}
return cfg, nil
}