Fix up incorrect variable name

This commit is contained in:
Eliot Whalan 2016-08-10 18:57:28 +10:00
parent eee90fc3ad
commit 13fa84be3a
1 changed files with 5 additions and 4 deletions

View File

@ -37,7 +37,7 @@ type Configuration struct {
// USERNAME for database // USERNAME for database
Username string Username string
// PASS database password // PASS database password
Pass string Password string
// NAME database name // NAME database name
Name string Name string
} }
@ -218,6 +218,9 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
b := Save(paste, lang, title, expiry) b := Save(paste, lang, title, expiry)
switch output { switch output {
case "redirect":
http.Redirect(w, r, b.URL, 301)
default: default:
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
err := json.NewEncoder(w).Encode(b) err := json.NewEncoder(w).Encode(b)
@ -226,8 +229,6 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
case "redirect":
http.Redirect(w, r, b.URL, 301)
} }
} }
@ -397,7 +398,7 @@ func main() {
panic(err) panic(err)
} }
DATABASE = configuration.Username + ":" + configuration.Pass + "@/" + configuration.Name + "?charset=utf8" DATABASE = configuration.Username + ":" + configuration.Password + "@/" + configuration.Name + "?charset=utf8"
// create new mux router // create new mux router
router := mux.NewRouter() router := mux.NewRouter()