diff options
Diffstat (limited to 'pkg/config/config.go')
-rw-r--r-- | pkg/config/config.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..31c2079 --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,22 @@ +package config + +import ( + "git.neonxp.ru/neonxp/guessr/pkg/db" + "github.com/caarlos0/env/v11" +) + +type Config struct { + Listen string `env:"LISTEN"` + Debug bool `env:"DEBUG"` + Keys []string `env:"KEYS"` + DB *db.Config +} + +func New() (*Config, error) { + cfg := &Config{ + Listen: ":8000", + DB: &db.Config{}, + } + + return cfg, env.Parse(cfg) +} |