VERSION_FILE = os.path.join(FE_PATH, 'version.js.proto')
SOURCES = [
+ 'config.go',
'paths.go',
'server.go',
'main.go'
--- /dev/null
+//
+// Armadillo File Manager
+// Copyright (c) 2010, Robert Sesek <http://www.bluestatic.org>
+//
+// This program is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or any later version.
+//
+
+package config
+
+type Configuration struct {
+ JailRoot string
+ Port int
+ ProxyURLs []string
+ Users map [string] string
+}
import (
"flag"
"fmt"
+ "./config"
"./paths"
"./server"
)
func main() {
+ var configPath *string = flag.String("config", "~/.armadillo", "Path to the configuration file")
+ var config = new(config.Configuration)
+ if len(*configPath) > 0 {
+ // Read configuration.
+ }
flag.StringVar(&paths.JailRoot, "jail", "/", "Restrict file operations to this directory root")
var port *int = flag.Int("port", 8080, "Port to run the server on")
flag.Parse()
+
+ config.JailRoot = paths.JailRoot
+ config.Port = *port
+
fmt.Printf("Starting Armadillo on port %d with root:\n %v\n", *port, paths.JailRoot)
- server.RunFrontEnd(*port)
+ server.RunFrontEnd(config)
}
"os"
"path"
"strings"
+ "./config"
"./paths"
)
}
}
-func RunFrontEnd(port int) {
+func RunFrontEnd(config *config.Configuration) {
mux := http.NewServeMux()
mux.HandleFunc("/", indexHandler)
mux.Handle("/fe/", http.FileServer(kFrontEndFiles, "/fe/"))
mux.HandleFunc("/service", serviceHandler)
- error := http.ListenAndServe(fmt.Sprintf(":%d", port), mux)
+ error := http.ListenAndServe(fmt.Sprintf(":%d", config.Port), mux)
fmt.Printf("error %v", error)
}