transmet/main.go

41 lines
519 B
Go
Raw Normal View History

2015-04-27 15:31:51 +00:00
package main
import (
"encoding/json"
"fmt"
"os"
)
const VERSION = "0.1"
type Config struct {
Sql struct {
Host string
Dbname string
Username string
Password string
}
}
var (
config Config
)
func loadConfig() {
file, err := os.Open("config/local.json")
if err != nil {
fmt.Println("Error: cannot open config file")
os.Exit(-1)
}
decoder := json.NewDecoder(file)
decoder.Decode(&config)
}
func main() {
fmt.Println("transmet ", VERSION)
fmt.Println("Loading...")
loadConfig()
}