X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/27cb596cfbff2f81210260d49f824bfdbac6dd5d..ad6e6f2457f354b666cdc322915d591743a4cd2f:/services/keep/keep.go diff --git a/services/keep/keep.go b/services/keep/keep.go index 7cca5344d8..85e2aea5ef 100644 --- a/services/keep/keep.go +++ b/services/keep/keep.go @@ -5,6 +5,7 @@ import ( "bytes" "crypto/md5" "errors" + "flag" "fmt" "github.com/gorilla/mux" "io/ioutil" @@ -17,8 +18,8 @@ import ( "time" ) -// Default TCP port on which to listen for requests. -const DEFAULT_PORT = 25107 +// Default TCP address on which to listen for requests. +const DEFAULT_ADDR = ":25107" // A Keep "block" is 64MB. const BLOCKSIZE = 64 * 1024 * 1024 @@ -50,8 +51,21 @@ func (e *KeepError) Error() string { } func main() { + // Parse command-line flags. + var listen, keepvols string + flag.StringVar(&listen, "listen", DEFAULT_ADDR, + "interface on which to listen for requests") + flag.StringVar(&keepvols, "volumes", "", + "comma-separated list of directories to use for Keep volumes") + flag.Parse() + // Look for local keep volumes. - KeepVolumes = FindKeepVolumes() + if keepvols == "" { + KeepVolumes = FindKeepVolumes() + } else { + KeepVolumes = strings.Split(keepvols, ",") + } + if len(KeepVolumes) == 0 { log.Fatal("could not find any keep volumes") } @@ -73,8 +87,7 @@ func main() { http.Handle("/", rest) // Start listening for requests. - port := fmt.Sprintf(":%d", DEFAULT_PORT) - http.ListenAndServe(port, nil) + http.ListenAndServe(listen, nil) } // FindKeepVolumes