Revert "Updating file path location search for config.json"

This reverts commit c5a2d036d7.

This commit was reverted since it breaks 'go run *.go', I plan on
bringing back custom config.json location with a switch instead.
This commit is contained in:
Sean DuBois 2014-07-04 13:22:48 +00:00
parent be624ce771
commit 598eea73e3

View file

@ -3,7 +3,6 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"path"
"github.com/Sean-Der/fail2go" "github.com/Sean-Der/fail2go"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"net/http" "net/http"
@ -22,11 +21,7 @@ type ErrorBody struct {
var fail2goConn *fail2go.Conn var fail2goConn *fail2go.Conn
func main() { func main() {
file, fileErr := os.Open("config.json")
//Changing path of current running directory to path of running executable for finding the config.json file.
//This will allow the creation of a linux service to run fail2rest (ie: service fail2rest start/stop/status)
var filePath string = path.Dir(os.Args[0])
file, fileErr := os.Open(filePath + "/config.json")
if fileErr != nil { if fileErr != nil {
fmt.Println("failed to open config:", fileErr) fmt.Println("failed to open config:", fileErr)