From 34ccc98a942098faefb5f4211b215ff9ccc7ad0e Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 9 Dec 2024 01:07:15 +0300 Subject: Начальный MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/config/config.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pkg/config/config.go (limited to 'pkg/config/config.go') 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) +} -- cgit v1.2.3