toml.go 793 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2017 The go-vgo Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // https://github.com/go-vgo/gt/blob/master/LICENSE
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. // +build toml
  11. package conf
  12. import (
  13. "log"
  14. "github.com/BurntSushi/toml"
  15. )
  16. // Init toml config
  17. func Init(fliePath string, config interface{}) {
  18. confLock.Lock()
  19. if _, err := toml.DecodeFile(filePath, config); err != nil {
  20. log.Println("toml.DecodeFile error: ", err)
  21. return
  22. }
  23. confLock.Unlock()
  24. }