itslog/config.go

28 lines
369 B
Go
Raw Normal View History

2013-12-20 23:04:33 -08:00
package main
import (
"errors"
)
type Configs struct {
2013-12-20 23:35:24 -08:00
Dbhost string
Dbname string
Dbport int
Port int
2013-12-20 23:04:33 -08:00
}
func NewConfig() *Configs {
return &Configs{
2013-12-20 23:35:24 -08:00
Dbname: "itslog",
Dbport: 5432,
Port: 80,
2013-12-20 23:04:33 -08:00
}
}
func (c *Configs) validate() error {
if c.Dbhost == "" {
return errors.New("must specify dbhost (export ITSLOG_DBHOST=blah.local)")
}
return nil
}