This repository has been archived on 2023-12-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
protect_trans_info/application/config.go
2023-08-24 23:40:46 +03:00

28 lines
608 B
Go

package application
import (
"context"
"fmt"
"time"
"github.com/sethvargo/go-envconfig"
)
func NewConfig() (Config, error) {
cfg := Config{}
if err := envconfig.Process(context.Background(), &cfg); err != nil {
return Config{}, fmt.Errorf("envconfig process: %w", err)
}
return cfg, nil
}
type Config struct {
Devel bool `env:"DEVEL"`
HTTPPort uint `env:"HTTP_PORT, default=8001"`
HTTPHost string `env:"HTTP_HOST,default=0.0.0.0"`
DB string `env:"DB_DSN"`
UpdateInterval time.Duration `env:"UPDATE_INTERVAL,default=1s"`
}