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.

27 lines
517 B

  1. package main
  2. import (
  3. "encoding/json"
  4. "io/ioutil"
  5. )
  6. //Config reads the config
  7. type Config struct {
  8. APIPort string `json:"apiport"`
  9. WebPort string `json:"webport"`
  10. Mongodb MongoConfig `json:"mongodb"`
  11. IPFSurl string `json:"ipfsurl"`
  12. }
  13. type MongoConfig struct {
  14. IP string `json:"ip"`
  15. Database string `json:"database"`
  16. }
  17. var config Config
  18. func readConfig(path string) {
  19. file, err := ioutil.ReadFile(path)
  20. check(err)
  21. content := string(file)
  22. json.Unmarshal([]byte(content), &config)
  23. }