summaryrefslogtreecommitdiff
path: root/cmd/addtoqueue/main.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-05-26 16:03:17 +0100
committerNick White <git@njw.name>2020-05-26 16:03:17 +0100
commit870fb0f3e01a0771d3839da2461e0cec30282bc0 (patch)
treec8f461ba1b829ce4d91d6eb90fd7d34f1e086845 /cmd/addtoqueue/main.go
parent3d2bdd1d30ec6d43b4921d29d5a8338d65c48a5a (diff)
parentebc27eef77868fa44daed7cfb0ea129690029da8 (diff)
Merge branch 'local'
Diffstat (limited to 'cmd/addtoqueue/main.go')
-rw-r--r--cmd/addtoqueue/main.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/addtoqueue/main.go b/cmd/addtoqueue/main.go
index 8e4ecd2..57087ca 100644
--- a/cmd/addtoqueue/main.go
+++ b/cmd/addtoqueue/main.go
@@ -14,7 +14,7 @@ import (
"rescribe.xyz/bookpipeline"
)
-const usage = `Usage: addtoqueue qname msg
+const usage = `Usage: addtoqueue [-c conn] qname msg
addtoqueue adds a message to a queue.
@@ -44,6 +44,7 @@ type QueuePipeliner interface {
}
func main() {
+ conntype := flag.String("c", "aws", "connection type ('aws' or 'local')")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), usage)
flag.PrintDefaults()
@@ -58,7 +59,15 @@ func main() {
var n NullWriter
quietlog := log.New(n, "", 0)
var conn QueuePipeliner
- conn = &bookpipeline.AwsConn{Region: "eu-west-2", Logger: quietlog}
+
+ switch *conntype {
+ case "aws":
+ conn = &bookpipeline.AwsConn{Region: "eu-west-2", Logger: quietlog}
+ case "local":
+ conn = &bookpipeline.LocalConn{Logger: quietlog}
+ default:
+ log.Fatalln("Unknown connection type")
+ }
err := conn.Init()
if err != nil {