Skip to content

Commit

Permalink
Add command line flag parsing; support for config file path
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Ward committed Oct 4, 2013
1 parent 9e922b8 commit d8d5050
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"log"
"flag"
"time"
"bytes"
"net/http"
Expand All @@ -13,8 +14,14 @@ import (
)

func main() {
// Parse command line arguments
var (
config_file = flag.String("config", "", "Path to configuration file")
)
flag.Parse()

// Load configuration into package variable Config
config_error := gcfg.ReadFileInto(&Config, "config/config.ini")
config_error := gcfg.ReadFileInto(&Config, *config_file)
if config_error != nil {
log.Fatal("Could not load config file: " + config_error.Error())
}
Expand Down

0 comments on commit d8d5050

Please sign in to comment.