Files
Erupe/config/config.go
2019-12-24 00:20:35 +09:00

26 lines
484 B
Go

package config
import "github.com/BurntSushi/toml"
// Config holds the configuration settings from the toml file.
type Config struct {
DB Database `toml:"database"`
}
// Database holds the postgres database config.
type Database struct {
Server string
Port int
}
// LoadConfig loads the given config toml file.
func LoadConfig(filepath string) (*Config, error) {
c := &Config{}
_, err := toml.DecodeFile(filepath, c)
if err != nil {
return nil, err
}
return c, nil
}