From 2866f9ccfd56bc1529c23748bbc6d8115a677952 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 31 Aug 2010 15:30:42 -0400 Subject: [PATCH] Add support for starting with a jailroot, rather than a hard-coded path. --- src/main.go | 8 ++++++-- src/paths.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.go b/src/main.go index df80253..4d2b5f8 100644 --- a/src/main.go +++ b/src/main.go @@ -2,11 +2,15 @@ package main import ( - "./server" + "flag" "fmt" + "./paths" + "./server" ) func main() { - fmt.Print("Hello world\n") + flag.StringVar(&paths.JailRoot, "jail", "/", "Restrict file operations to this directory root") + flag.Parse() + fmt.Printf("Starting Armadillo with root:\n %v\n", paths.JailRoot) server.RunFrontEnd() } diff --git a/src/paths.go b/src/paths.go index 7deab6f..25ffcec 100644 --- a/src/paths.go +++ b/src/paths.go @@ -6,10 +6,10 @@ import ( "path" ) -const kJailRoot = "/Users/rsesek/Downloads" +var JailRoot string; func canonicalizePath(raw_path string) string { - raw_path = path.Join(kJailRoot, raw_path) + raw_path = path.Join(JailRoot, raw_path) return path.Clean(raw_path) } -- 2.43.5