Skip to content

Commit

Permalink
v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Oct 28, 2015
1 parent b4b1116 commit bae6f09
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/CoreOS GUI/CoreOS GUI-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.3</string>
<string>1.0.4</string>
<key>CFBundleVersion</key>
<string>411</string>
<string>413</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Binary file modified src/bin/coreos-osx-web
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bin/webserver
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
res_folder=$(cat ~/coreos-osx/.env/resouces_path)

start() {
nohup "${res_folder}"/bin/coreos-osx-web >/dev/null 2>&1 &
nohup "${res_folder}"/bin/coreos-osx-web -port 18000 >/dev/null 2>&1 &
}

stop() {
Expand Down
Binary file modified src/files/docker2aci
Binary file not shown.
30 changes: 24 additions & 6 deletions src/go_webserver/coreos-osx-web.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
// A humble replacement to the famous Python SimpleHTTPServer
package main

import (
"flag"
"fmt"
"log"
"net/http"
)

// HTTP Handler that logs the requested resources via the "log" module
func logHandler(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Printf("%s %s ", r.Method, r.URL)
handler.ServeHTTP(w, r)
})
}

func main() {
fmt.Println("Serving files in the current directory on port 18000")
http.Handle("/", http.FileServer(http.Dir(".")))
err := http.ListenAndServe(":18000", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}

directoryOption := flag.String("directory", ".", "the directory to serve via HTTP (default is current directory)")
portOption := flag.Int("port", 8080, "the listening port (default is 8080)")
flag.Parse()

var directory = http.Dir(*directoryOption)
var fileServer = http.FileServer(directory)
var port = *portOption

var host = fmt.Sprintf(":%d", port)
var handler = logHandler(fileServer)

log.Printf("Staring HTTP server on http://127.0.0.1:%d/ in directory %v", port, directory)
log.Fatal(http.ListenAndServe(host, handler))
}

3 changes: 3 additions & 0 deletions src/halt.command
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# halt.command
# stop VM via ssh

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# get App's Resources folder
res_folder=$(cat ~/coreos-osx/.env/resouces_path)

Expand Down

0 comments on commit bae6f09

Please sign in to comment.