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