summaryrefslogtreecommitdiff
path: root/pkg/config/config.go
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-12-09 01:07:15 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-12-09 01:07:15 +0300
commit34ccc98a942098faefb5f4211b215ff9ccc7ad0e (patch)
tree7696ab4d7c8d9fb09c7e2575d482517f68824ae3 /pkg/config/config.go
Начальный
Diffstat (limited to 'pkg/config/config.go')
-rw-r--r--pkg/config/config.go22
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)
+}