diff options
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 52 | 
1 files changed, 0 insertions, 52 deletions
| diff --git a/config.go b/config.go deleted file mode 100644 index e28cc1b..0000000 --- a/config.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( -	"encoding/json" -	"flag" -	"io/ioutil" -	"log" -	"os" -	"path/filepath" -) - -type RuntimeConfig struct { -	Path      string -	Host      string `json:"bind_host"` -	Port      string `json:"bind_port"` -	Static    string `json:"static"` -	Templates string `json:"templates"` -	Data      string `json:"data"` -} - -func GetRuntimeConfig() RuntimeConfig { - -	config := RuntimeConfig{} - -	flag.StringVar(&config.Path, "c", "/etc/ceres/config.json", -		"Path to ceres configuration file") -	flag.Parse() - -	configFile, err := os.Open(config.Path) -	defer configFile.Close() -	if err != nil { -		log.Fatalf("Could not open configuration file %s", config.Path) -	} - -	configData, err := ioutil.ReadAll(configFile) -	if err != nil { -		log.Fatalf("Could not read configuration file %s", config.Path) -	} - -	err = json.Unmarshal(configData, &config) -	if err != nil { -		log.Fatalf("Could not parse configuration file %s", config.Path) -	} - -	abs, err := filepath.Abs(config.Path) -	if err != nil { -		log.Fatalf("Could not translate %s to absolute path.", config.Path) -	} -	log.Printf("Config file: %s\n", abs) - -	return config -} | 
