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.

35 lines
845 B

  1. package main
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "io/ioutil"
  6. )
  7. //RepeatPages is from the json config, is an array inside KonstruiConfig
  8. type RepeatPages struct {
  9. HtmlPage string `json:"htmlPage"`
  10. Data string `json:"data"`
  11. }
  12. //KonstruiConfig is the configuration from the file konstruiConfig.json, on the folder /webInput
  13. type KonstruiConfig struct {
  14. Title string `json:"title"`
  15. Author string `json:"author"`
  16. Github string `json:"github"`
  17. Website string `json:"website"`
  18. Files []string `json:"files"`
  19. RepeatPages []RepeatPages
  20. CopyRaw []string `json:"copyRaw"`
  21. }
  22. var konstruiConfig KonstruiConfig
  23. func readKonstruiConfig(path string) {
  24. file, e := ioutil.ReadFile(path)
  25. if e != nil {
  26. fmt.Println("error:", e)
  27. }
  28. content := string(file)
  29. json.Unmarshal([]byte(content), &konstruiConfig)
  30. }