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.

25 lines
450 B

7 years ago
7 years ago
  1. package main
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "io/ioutil"
  6. )
  7. type Config struct {
  8. ServerIP string `json:"serverIP"`
  9. ServerPort string `json:"serverPort"`
  10. ImgWidth int `json:"imgWidth"`
  11. ImgHeigh int `json:"imgHeigh"`
  12. }
  13. var config Config
  14. func readConfig(path string) {
  15. file, err := ioutil.ReadFile(path)
  16. if err != nil {
  17. fmt.Println("error: ", err)
  18. }
  19. content := string(file)
  20. json.Unmarshal([]byte(content), &config)
  21. }