// Run the server.
fmt.Printf("Starting Armadillo on port %d with root:\n %v\n",
configuration.Port, configuration.JailRoot)
- server.SetConfig(configuration)
- server.RunBackEnd()
+ server.RunBackEnd(configuration)
}
var kFrontEndFiles string = path.Join(dir, "frontend")
var gConfig *config.Configuration
-func SetConfig(aConfig *config.Configuration) {
- gConfig = aConfig
-}
-
func indexHandler(response http.ResponseWriter, request *http.Request) {
fd, err := os.Open(path.Join(kFrontEndFiles, "index.html"))
if err != nil {
}
}
-func RunBackEnd() {
+func RunBackEnd(c *config.Configuration) {
+ gConfig = c
+
mux := http.NewServeMux()
mux.HandleFunc("/", indexHandler)
mux.Handle("/fe/", http.StripPrefix("/fe/", http.FileServer(http.Dir(kFrontEndFiles))))