Commit a9b5b07

Richard Luby <richluby@gmail.com>
2016-10-27 14:28:45
client has default config
moved code from client configuration so as to not require a file on the command-line
1 parent bd9df9c
Changed files (1)
client.go
@@ -29,9 +29,6 @@ var config CONFIG
 // loadClientConfiguration loads the configuration for the client using the given string
 func loadClientConfiguration(cfgFile string) CONFIG {
 	log.Printf("Loading configuration from %s.", cfgFile)
-	config.SERVER = "127.0.0.1"
-	config.PORT = 8080
-	config.USE_HTTPS = false
 	_, err := toml.DecodeFile(cfgFile, &config)
 	if err != nil {
 		log.Fatalf("Could not read configuration file: %+v\n", err.Error())
@@ -93,6 +90,9 @@ func initUserSession() {
 
 // initializes the client and handles the user interaction
 func main() {
+	config.SERVER = "127.0.0.1"
+	config.PORT = 80
+	config.USE_HTTPS = false
 	filePath := flag.String("file", "", "defines a path to the configuration file")
 	flag.Parse()
 	if strings.Compare(*filePath, "") != 0 {