22 lines
316 B
Go
22 lines
316 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/pelletier/go-toml/v2"
|
|
)
|
|
|
|
func LoadConfig(config interface{}) {
|
|
if err := toml.Unmarshal(readFile("config.toml"), config); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func readFile(path string) []byte {
|
|
data, err := os.ReadFile(path)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return data
|
|
}
|