Ejemplo n.º 1
0
func config(w http.ResponseWriter, r *http.Request) {
	confenc := r.FormValue("config")
	config, err := base64.StdEncoding.DecodeString(confenc)
	if err != nil {
		fmt.Fprintf(w, "%s", "Error decoding new url")
	} else {
		if status := ego.GetStatus(string(config)); status {
			err := ego.SetURL(string(config))
			if err != nil {
				fmt.Fprintf(w, "%s", err)
			} else {
				fmt.Fprintf(w, "%s", "Elasticsearch URL changed to "+string(config))
			}
		} else {
			fmt.Fprintf(w, "%s", "Error reading status from url "+string(config)+" is not a valid elasticsearch host, or is not active")
		}
	}
}
Ejemplo n.º 2
0
func loadAdmin() (*Page, error) {
	//status := ego.GetStatus(ego.URL)
	return &Page{Title: "Restfish", Enviroment: ego.Enviroment, URL: ego.URL, Status: ego.GetStatus(ego.URL)}, nil
}