summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ninjacloud.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ninjacloud.go b/src/ninjacloud.go
index 0915e40..a53261a 100644
--- a/src/ninjacloud.go
+++ b/src/ninjacloud.go
@@ -618,11 +618,10 @@ func getDataHandler(w http.ResponseWriter, r *http.Request) {
618 618
619// Get the cloud status JSON 619// Get the cloud status JSON
620func getStatusHandler(w http.ResponseWriter, r *http.Request) { 620func getStatusHandler(w http.ResponseWriter, r *http.Request) {
621 w.Header().Add("Cache-Control", "no-cache")
622 cloudStatus := map[string]string{ 621 cloudStatus := map[string]string{
623 "name": APP_NAME, 622 "name": APP_NAME,
624 "version": APP_VERSION, 623 "version": APP_VERSION,
625 "server-root": "", 624 "server-root": drivePrefix,
626 "status": "running", 625 "status": "running",
627 } 626 }
628 j, err := json.MarshalIndent(cloudStatus, "", " ") 627 j, err := json.MarshalIndent(cloudStatus, "", " ")
@@ -649,7 +648,14 @@ func main() {
649 return 648 return
650 } 649 }
651 650
652 log.Println("Starting " + APP_NAME + " " + APP_VERSION + " on " + interfaceFlag + ":" + portFlag + " in " + rootFlag) 651 err := os.Chdir(rootFlag)
652 currentDir, err := os.Getwd()
653 if err != nil {
654 log.Println(err)
655 return
656 }
657
658 log.Println("Starting " + APP_NAME + " " + APP_VERSION + " on " + interfaceFlag + ":" + portFlag + " in " + currentDir)
653 log.Println("pacien.net/projects/ninja-go-local-cloud") 659 log.Println("pacien.net/projects/ninja-go-local-cloud")
654 660
655 http.HandleFunc(filePath, fileHandler) 661 http.HandleFunc(filePath, fileHandler)
@@ -657,7 +663,6 @@ func main() {
657 http.HandleFunc(webPath, getDataHandler) 663 http.HandleFunc(webPath, getDataHandler)
658 http.HandleFunc(statusPath, getStatusHandler) 664 http.HandleFunc(statusPath, getStatusHandler)
659 665
660 err := os.Chdir(rootFlag)
661 err = http.ListenAndServe(interfaceFlag+":"+portFlag, nil) 666 err = http.ListenAndServe(interfaceFlag+":"+portFlag, nil)
662 if err != nil { 667 if err != nil {
663 log.Println(err) 668 log.Println(err)