Files
opencloud/tests/ociswrapper/wrapper/wrapper.go

37 lines
647 B
Go

package wrapper
import (
"fmt"
"net/http"
"ociswrapper/common"
"ociswrapper/log"
"ociswrapper/ocis/config"
"ociswrapper/wrapper/handlers"
)
func Start(port string) {
defer common.Wg.Done()
if port == "" {
port = config.Get("port")
}
httpServer := &http.Server{
Addr: ":" + port,
}
var mux = http.NewServeMux()
mux.HandleFunc("/", http.NotFound)
mux.HandleFunc("/config", handlers.SetEnvHandler)
mux.HandleFunc("/rollback", handlers.RollbackHandler)
httpServer.Handler = mux
log.Println(fmt.Sprintf("Starting ociswrapper on port %s...", port))
err := httpServer.ListenAndServe()
if err != nil {
log.Panic(err)
}
}