@@ -31,7 +31,10 @@ import (
3131
3232// NewCommand implements the cli http command
3333func NewCommand (fullName string , err * os.File , out * os.File , in * os.File ) * cobra.Command {
34- var port uint
34+ var (
35+ port uint
36+ ingressDescriptor string
37+ )
3538
3639 cmd := & cobra.Command {
3740 Use : "http" ,
@@ -46,23 +49,23 @@ func NewCommand(fullName string, err *os.File, out *os.File, in *os.File) *cobra
4649
4750 api .Path ("/data/{dataSource}" ).
4851 Methods (http .MethodGet ).
49- HandlerFunc (pull .Handler )
52+ HandlerFunc (pull .HandlerFactory ( ingressDescriptor ) )
5053
5154 api .Path ("/data/{dataDestination}" ).
5255 Queries ("mode" , "delete" ).
53- HandlerFunc (push .DeleteHandler )
56+ HandlerFunc (push .DeleteHandlerFactory ( ingressDescriptor ) )
5457
5558 api .Path ("/data/{dataDestination}" ).
5659 Queries ("mode" , "insert" ).
57- HandlerFunc (push .InsertHandler )
60+ HandlerFunc (push .InsertHandlerFactory ( ingressDescriptor ) )
5861
5962 api .Path ("/data/{dataDestination}" ).
6063 Queries ("mode" , "truncate" ).
61- HandlerFunc (push .TruncatHandler )
64+ HandlerFunc (push .TruncatHandlerFactory ( ingressDescriptor ) )
6265
6366 api .Path ("/data/{dataDestination}" ).
6467 Methods (http .MethodPost ).
65- HandlerFunc (push .TruncatHandler )
68+ HandlerFunc (push .TruncatHandlerFactory ( ingressDescriptor ) )
6669
6770 http .Handle ("/" , r )
6871 bind := fmt .Sprintf (":%d" , port )
@@ -75,6 +78,7 @@ func NewCommand(fullName string, err *os.File, out *os.File, in *os.File) *cobra
7578 },
7679 }
7780 cmd .Flags ().UintVarP (& port , "port" , "p" , 8000 , "HTTP Port to bind" )
81+ cmd .Flags ().StringVarP (& ingressDescriptor , "ingress-descriptor" , "i" , "ingress-descriptor.yaml" , "Ingress descriptor filename" )
7882 cmd .SetOut (out )
7983 cmd .SetErr (err )
8084 cmd .SetIn (in )
0 commit comments