mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 08:25:09 +01:00
26 lines
484 B
Go
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
|
|
}
|