summaryrefslogtreecommitdiff
path: root/cmd/addtoqueue/main.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-05-26 16:03:12 +0100
committerNick White <git@njw.name>2020-05-26 16:03:12 +0100
commitebc27eef77868fa44daed7cfb0ea129690029da8 (patch)
treec8f461ba1b829ce4d91d6eb90fd7d34f1e086845 /cmd/addtoqueue/main.go
parented561822b58756c101654946cff0617a6038bc2c (diff)
Add -c conntype for necessary tools to allow local connection to be used
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 {