update
arnaucode idoctnef@openmailbox.org
Wed, 21 Jun 2017 16:10:45 +0200
4 files changed,
7 insertions(+),
5 deletions(-)
M
config.json
→
config.json
@@ -1,8 +1,8 @@
{ + "serverIP": "127.0.0.1", + "serverPort": "3050", "folder": "files", "blockedIPs": [ - "192.168.1.3", - "147.116.48.158" ], "allowedIPs": [ "127.0.0.1"
M
handlers.go
→
handlers.go
@@ -18,7 +18,7 @@ func ImageShow(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) imageName := vars["imageName"] - file, err := ioutil.ReadFile(imageName) + file, err := ioutil.ReadFile(config.Folder + "/" + imageName) if err != nil { fmt.Fprintln(w, err) }@@ -63,5 +63,5 @@ if err != nil {
fmt.Println(err) } - fmt.Fprintln(w, "url:", fileName) + fmt.Fprintln(w, config.ServerIP+":"+config.ServerPort+"/images/"+fileName) }
M
readConfig.go
→
readConfig.go
@@ -7,6 +7,8 @@ "io/ioutil"
) type Config struct { + ServerIP string `json:"serverIP"` + ServerPort string `json:"serverPort"` Folder string `json:"foldIPs` BlockedIPs []string `json:"blockedIPs"` AllowedIPs []string `json:"allowedIPs"`