Commit 7644c33b authored by Bruce Flynn's avatar Bruce Flynn
Browse files

add simple index

parent 929d5605
......@@ -62,7 +62,23 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
log.Printf("successfully handled chart %s", path.Base(p))
func handleGet(w http.ResponseWriter, r *http.Request) {
func handleGetHome(w http.ResponseWriter, r *http.Request) {
<h1>Chart Repository</h1>
To add this repostory to Helm, run:
helm repo add &lt;name&gt; %s
`, url)))
func handleGetFile(w http.ResponseWriter, r *http.Request) {
p := path.Join(dir, r.URL.Path)
if st, err := os.Stat(p); os.IsNotExist(err) || st.IsDir() {
http.Error(w, "Not Found", http.StatusNotFound)
......@@ -86,7 +102,11 @@ func handle(w http.ResponseWriter, r *http.Request) {
case "PUT":
handleUpload(w, r)
case "GET":
handleGet(w, r)
if r.URL.Path == "/" {
handleGetHome(w, r)
} else {
handleGetFile(w, r)
http.Error(w, "Bad Request", http.StatusBadRequest)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment