27 lines
623 B
Go
27 lines
623 B
Go
// package main is the main package for the LapisDeploy program
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"encoding/json"
|
|
"log"
|
|
)
|
|
|
|
// Configuration stores information retrieved from a configuration file
|
|
type Configuration struct {
|
|
sites_dir string
|
|
}
|
|
|
|
// parseConfig parses the JSON configuration file at 'path' and stores the contents in 'config'
|
|
func parseConfig(path string, config *Configuration) {
|
|
file, _ := os.Open(path)
|
|
var data map[string]interface{}
|
|
err := json.NewDecoder(file).Decode(&data)
|
|
if err != nil {
|
|
log.Panic("Failed to parse config:", err)
|
|
}
|
|
file.Close()
|
|
config.sites_dir = data["sites_dir"].(string)
|
|
}
|
|
|