]>
src.bluestatic.org Git - armadillo.git/blob - src/main.go
2 // Armadillo File Manager
3 // Copyright (c) 2010, Robert Sesek <http://www.bluestatic.org>
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.
21 // Set up the basic flags.
22 var configPath
*string = flag
.String("config", "~/.armadillo", "Path to the configuration file")
23 var jailRoot
*string = flag
.String("jail", "", "Restrict file operations to this directory root")
24 var port
*int = flag
.Int("port", 0, "Port to run the server on")
27 // Load the configuration file, if it is present.
28 var configuration
= new(config
.Configuration
)
29 fmt
.Printf("Reading configuration from %v\n", *configPath
)
30 if len(*configPath
) > 0 {
31 error
:= config
.ReadFromFile(*configPath
, configuration
)
33 fmt
.Printf("Error while reading configuration: %v\n", error
)
37 // Override configuration values with command line arguments.
39 configuration
.JailRoot
= *jailRoot
42 configuration
.Port
= *port
46 fmt
.Printf("Starting Armadillo on port %d with root:\n %v\n",
47 configuration
.Port
, configuration
.JailRoot
)
48 paths
.SetConfig(configuration
)
49 server
.RunBackEnd(configuration
)