summaryrefslogtreecommitdiff
path: root/pkg/config/config.go
blob: 31c20796ed81ee17a931f06c9ec5cd1066cdd374 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
}