aboutsummaryrefslogblamecommitdiff
path: root/config/config.go
blob: dcce7a9d3501534d7fb4b8a1819abadc8ef98625 (plain) (tree)




















                                                                                         
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
}