1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 10:22:53 +00:00

moved server to separate repo

This commit is contained in:
2016-08-28 19:21:54 -05:00
parent 1c224f95ab
commit 29448c29a8
13 changed files with 2 additions and 796 deletions

View File

@@ -1,44 +0,0 @@
package utils
import (
"encoding/json"
"io/ioutil"
"log"
"os"
"server/controller/api"
"server/db"
)
//structure for application configurations
type Config struct {
Database db.DatabaseInfo `json:"database"`
Api api.ApiInfo `json:"api"`
}
//read the config file and return JsonObject struct
func ReadConfig() Config {
log.Println("Reading config file...")
file, e := ioutil.ReadFile("./config.json")
if e != nil {
log.Printf("File error: %v\n", e)
os.Exit(1)
}
log.Printf("%s\n", string(file))
//m := new(Dispatch)
//var m interface{}
var result Config
err := json.Unmarshal(file, &result)
if err != nil {
log.Println(err)
}
return result
}