aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <i@neonxp.ru>2024-07-20 21:56:37 +0300
committerAlexander NeonXP Kiryukhin <i@neonxp.ru>2024-07-20 21:58:27 +0300
commite9a64f3b41b5eae47dec7c0ecfd1caae83136abc (patch)
treec07898520a7015c3f2a201ca0674efea82dd76a5 /config
parent9c0a6b21f8f8d9b725e1fe7f11da4532e04fd9f1 (diff)
initialv0.0.1
Diffstat (limited to 'config')
-rw-r--r--config/config.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go
new file mode 100644
index 0000000..dcce7a9
--- /dev/null
+++ b/config/config.go
@@ -0,0 +1,21 @@
+package config
+
+import "flag"
+
+type Config struct {
+ Listen string
+ DB string
+ Theme string
+ SessionSecret string
+}
+
+func New() *Config {
+ cfg := new(Config)
+ flag.StringVar(&cfg.DB, "db", "gorum.db", "path to db file")
+ flag.StringVar(&cfg.Listen, "listen", ":8000", "addr to listen")
+ flag.StringVar(&cfg.Theme, "theme", "default", "color theme")
+ flag.StringVar(&cfg.SessionSecret, "sesstion-secret", "s3cr3t", "session secret")
+ flag.Parse()
+
+ return cfg
+}