2024-10-09 11:59:42 +00:00
|
|
|
package config
|
|
|
|
|
2024-10-09 12:27:29 +00:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/BurntSushi/toml"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
)
|
2024-10-09 11:59:42 +00:00
|
|
|
|
|
|
|
// Parse the config
|
|
|
|
func Parse(content []byte) *Config {
|
|
|
|
var cfg *Config
|
|
|
|
|
|
|
|
err := toml.Unmarshal(content, &cfg)
|
|
|
|
if err != nil {
|
2024-10-09 12:27:29 +00:00
|
|
|
log.Err(err).Msg("")
|
|
|
|
os.Exit(1)
|
2024-10-09 11:59:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return cfg
|
|
|
|
}
|