Public Repository

Last pushed: 2 years ago
Short Description
Hello!
Full Description

///CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" hello.go

package main

import (
"fmt"
auth "github.com/abbot/go-http-auth"
"log"
"net/http"
)

func hello(w http.ResponseWriter, r *auth.AuthenticatedRequest) {
fmt.Fprintf(w, "Hello, %s!", r.Username)))
}

func main() {
log.Print("Start...")
htpasswd := auth.HtpasswdFileProvider("./.htpasswd")
a := auth.NewBasicAuthenticator("i", htpasswd)
http.HandleFunc("/", a.Wrap(hello))
log.Fatal(http.ListenAndServe("", nil))
}

Docker Pull Command
Owner
moonsmile