diff --git a/config.go b/config.go index ff33fcc..3af4430 100644 --- a/config.go +++ b/config.go @@ -9,6 +9,7 @@ import ( // Configuration stores information retrieved from a configuration file type Configuration struct { + port int sites_dir string } @@ -21,6 +22,7 @@ func parseConfig(path string, config *Configuration) { log.Panic("Failed to parse config:", err) } file.Close() + config.port = int(data["port"].(float64)) // this conversion makes no sense config.sites_dir = data["sites_dir"].(string) } diff --git a/config.json b/config.json index 6b23d7b..f70fb4d 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,4 @@ { + "port": 7575, "sites_dir": "./sites" } diff --git a/main.go b/main.go index b3509a7..9446f37 100644 --- a/main.go +++ b/main.go @@ -60,6 +60,6 @@ func main() { go handler(data) // Run the handler fmt.Fprint(w, "Received!") }) - log.Printf("Starting Lapis Deploy...") - log.Fatal(http.ListenAndServe(":7575", nil)) + log.Printf("Starting Lapis Deploy on port %d...", configuration.port) + log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", configuration.port), nil)) }