28 lines
369 B
Go
28 lines
369 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type Configs struct {
|
|
Dbhost string
|
|
Dbname string
|
|
Dbport int
|
|
Port int
|
|
}
|
|
|
|
func NewConfig() *Configs {
|
|
return &Configs{
|
|
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
|
|
}
|