You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
380 B

5 years ago
  1. package main
  2. import "github.com/spf13/viper"
  3. type Config struct {
  4. GethURL string
  5. PrivK string
  6. }
  7. var config Config
  8. func ReadConfig(path, filename string) {
  9. viper.SetConfigName(filename)
  10. viper.AddConfigPath(path)
  11. viper.SetConfigType("yaml")
  12. if err := viper.ReadInConfig(); err != nil {
  13. panic(err)
  14. }
  15. err := viper.Unmarshal(&config)
  16. if err != nil {
  17. panic(err)
  18. }
  19. }