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.

28 lines
569 B

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. Folder string `json:"foldIPs`
  11. BlockedIPs []string `json:"blockedIPs"`
  12. AllowedIPs []string `json:"allowedIPs"`
  13. ImgWidth int `json:"imgWidth"`
  14. ImgHeigh int `json:"imgHeigh"`
  15. }
  16. var config Config
  17. func readConfig(path string) {
  18. file, err := ioutil.ReadFile(path)
  19. if err != nil {
  20. fmt.Println("error: ", err)
  21. }
  22. content := string(file)
  23. json.Unmarshal([]byte(content), &config)
  24. }