feat: it works
This commit is contained in:
parent
6302dd62d6
commit
778d5ef146
25 changed files with 638 additions and 106 deletions
23
internal/repository/config.go
Normal file
23
internal/repository/config.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue