30 lines
407 B
Go
30 lines
407 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
)
|
||
|
|
||
|
type Configs struct {
|
||
|
Verbose bool
|
||
|
Dbhost string
|
||
|
Dbname string
|
||
|
Dbport int
|
||
|
Port int
|
||
|
}
|
||
|
|
||
|
func NewConfig() *Configs {
|
||
|
return &Configs{
|
||
|
Verbose: true,
|
||
|
Dbname: "itslog",
|
||
|
Dbport: 5432,
|
||
|
Port: 80,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (c *Configs) validate() error {
|
||
|
if c.Dbhost == "" {
|
||
|
return errors.New("must specify dbhost (export ITSLOG_DBHOST=blah.local)")
|
||
|
}
|
||
|
return nil
|
||
|
}
|