Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/config/parser.go
akuma06 e116b30b40 Better handle of test files
After some thoughts, it is better to use the config from config files
than default ones
2017-05-31 10:49:01 +02:00

25 lignes
446 o
Go

package config
import (
"io/ioutil"
"log"
yaml "gopkg.in/yaml.v2"
)
// DefaultConfig : Default configuration
var DefaultConfig *Config
func getDefaultConfig() *Config {
DefaultConfig = &Config{}
data, err := ioutil.ReadFile(DefaultConfigPath)
if err != nil {
log.Printf("can't read file '%s'", DefaultConfigPath)
}
err = yaml.Unmarshal(data, DefaultConfig)
if err != nil {
log.Printf("error: %v", err)
}
return DefaultConfig
}