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.

26 lines
489 B

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