mirror of
https://github.com/ChronosX88/yans.git
synced 2024-11-24 20:32:19 +00:00
24 lines
321 B
Go
24 lines
321 B
Go
package config
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
Port int
|
|
DatabasePath string
|
|
}
|
|
|
|
func ParseConfig(path string) (Config, error) {
|
|
cfg := Config{}
|
|
|
|
data, _ := os.ReadFile(path)
|
|
err := toml.Unmarshal(data, &cfg)
|
|
if err != nil {
|
|
return Config{}, err
|
|
}
|
|
|
|
return cfg, nil
|
|
}
|