now serving files from a downloads directory so that the executables

can be downloaded from a ci job
This commit is contained in:
Erik Brakkee 2024-07-21 14:30:01 +02:00
parent 85caa6cb5a
commit dedbc39144

View File

@ -7,6 +7,7 @@ import (
"log" "log"
"net" "net"
"net/http" "net/http"
"os"
"regexp" "regexp"
) )
@ -21,6 +22,11 @@ func parsePublicId(path string) (publicId string, _ error) {
func main() { func main() {
downloadDir := "downloads"
if len(os.Args) == 2 {
downloadDir = os.Args[1]
}
admin := converge.NewAdmin() admin := converge.NewAdmin()
registrationService := websocketutil.WebSocketService{ registrationService := websocketutil.WebSocketService{
Handler: func(w http.ResponseWriter, r *http.Request, conn net.Conn) { Handler: func(w http.ResponseWriter, r *http.Request, conn net.Conn) {
@ -53,6 +59,7 @@ func main() {
http.HandleFunc("/agent/", registrationService.Handle) http.HandleFunc("/agent/", registrationService.Handle)
http.HandleFunc("/client/", clientService.Handle) http.HandleFunc("/client/", clientService.Handle)
http.Handle("/downloads/", http.StripPrefix("/downloads/", http.FileServer(http.Dir(downloadDir))))
// Start HTTP server // Start HTTP server
fmt.Println("Rendez-vous server listening on :8000") fmt.Println("Rendez-vous server listening on :8000")