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.

29 lines
629 B

6 years ago
  1. package main
  2. import (
  3. "encoding/json"
  4. "io/ioutil"
  5. )
  6. type Post struct {
  7. Title string `json:"title"`
  8. Thumb string `json:"thumb"`
  9. Md string `json:"md"`
  10. }
  11. type Config struct {
  12. Title string `json:"title"`
  13. IndexTemplate string `json:"indexTemplate"`
  14. IndexPostTemplate string `json:"indexPostTemplate"`
  15. PostTemplate string `json:"postTemplate"`
  16. Posts []Post `json:"posts"`
  17. CopyRaw []string `json:"copyRaw"`
  18. }
  19. var config Config
  20. func readConfig(path string) {
  21. file, err := ioutil.ReadFile(path)
  22. check(err)
  23. content := string(file)
  24. json.Unmarshal([]byte(content), &config)
  25. }