Bel LaPointe 2024-12-14 20:46:17 -07:00
parent aa330dffea
commit 2b958fafe9
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,10 @@ import (
type Config struct { type Config struct {
Port int Port int
Root string Root string
DB struct {
Scheme string
Conn string
}
} }
func NewConfig() (Config, error) { func NewConfig() (Config, error) {
@ -19,6 +23,8 @@ func NewConfig() (Config, error) {
fs.IntVar(&c.Port, "p", 8080, "port") fs.IntVar(&c.Port, "p", 8080, "port")
fs.StringVar(&c.Root, "r", "/tmp/", "static file root") fs.StringVar(&c.Root, "r", "/tmp/", "static file root")
fs.StringVar(&c.DB.Scheme, "db-scheme", "sqlite", "sql scheme")
fs.StringVar(&c.DB.Conn, "db-conn", "/tmp/out.sql", "sql conn string")
err := fs.Parse(os.Args[1:]) err := fs.Parse(os.Args[1:])
return c, err return c, err