Create a Configuration struct and use that to RunFrontEnd().
[armadillo.git] / src / main.go
1 //
2 // Armadillo File Manager
3 // Copyright (c) 2010, Robert Sesek <http://www.bluestatic.org>
4 //
5 // This program is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free Software
7 // Foundation, either version 3 of the License, or any later version.
8 //
9
10 package main
11
12 import (
13 "flag"
14 "fmt"
15 "./config"
16 "./paths"
17 "./server"
18 )
19
20 func main() {
21 var configPath *string = flag.String("config", "~/.armadillo", "Path to the configuration file")
22 var config = new(config.Configuration)
23 if len(*configPath) > 0 {
24 // Read configuration.
25 }
26 flag.StringVar(&paths.JailRoot, "jail", "/", "Restrict file operations to this directory root")
27 var port *int = flag.Int("port", 8080, "Port to run the server on")
28 flag.Parse()
29
30 config.JailRoot = paths.JailRoot
31 config.Port = *port
32
33 fmt.Printf("Starting Armadillo on port %d with root:\n %v\n", *port, paths.JailRoot)
34 server.RunFrontEnd(config)
35 }