[ARVADOS] created: c4a50125bec07063e91be6ca7c7ce209d5840642
git at public.curoverse.com
git at public.curoverse.com
Fri Apr 4 17:03:38 EDT 2014
at c4a50125bec07063e91be6ca7c7ce209d5840642 (commit)
commit c4a50125bec07063e91be6ca7c7ce209d5840642
Author: Tim Pierce <twp at curoverse.com>
Date: Fri Apr 4 17:04:28 2014 -0400
Add command-line flags. (refs #2463)
diff --git a/services/keep/keep.go b/services/keep/keep.go
index daa967b..aa95d02 100644
--- a/services/keep/keep.go
+++ b/services/keep/keep.go
@@ -4,6 +4,7 @@ import (
"bufio"
"crypto/md5"
"errors"
+ "flag"
"fmt"
"github.com/gorilla/mux"
"log"
@@ -12,7 +13,7 @@ import (
"strings"
)
-const DEFAULT_PORT = 25107
+const DEFAULT_ADDR = ":25107"
const BLOCKSIZE = 64 * 1024 * 1024
var PROC_MOUNTS = "/proc/mounts"
@@ -29,8 +30,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")
}
@@ -52,8 +66,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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list