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.

30 lines
689 B

  1. package main
  2. import (
  3. "encoding/json"
  4. "io/ioutil"
  5. )
  6. //Config reads the config
  7. type Config struct {
  8. IP string `json:"ip"`
  9. Port string `json:"port"`
  10. ServerIP string `json:"serverip"`
  11. ServerPort string `json:"serverport"`
  12. ServerRESTPort string `json:"serverrestport"`
  13. WebServerPort string `json:"webserverport"`
  14. Mongodb MongoConfig `json:"mongodb"`
  15. }
  16. type MongoConfig struct {
  17. IP string `json:"ip"`
  18. Database string `json:"database"`
  19. }
  20. var config Config
  21. func readConfig(path string) {
  22. file, err := ioutil.ReadFile(path)
  23. check(err)
  24. content := string(file)
  25. json.Unmarshal([]byte(content), &config)
  26. }