summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/init.go13
-rw-r--r--conf/parser.go10
2 files changed, 20 insertions, 3 deletions
diff --git a/conf/init.go b/conf/init.go
new file mode 100644
index 0000000..f7d1761
--- /dev/null
+++ b/conf/init.go
@@ -0,0 +1,13 @@
+package conf
+
+import (
+ // Initialize the different modules. By importing them in this
+ // way, their constructors are registered in the registry.
+ _ "github.com/Shugyousha/stasher/input/http"
+ _ "github.com/Shugyousha/stasher/input/stdin"
+
+ _ "github.com/Shugyousha/stasher/filter/http"
+ _ "github.com/Shugyousha/stasher/filter/str"
+
+ _ "github.com/Shugyousha/stasher/output/stdout"
+)
diff --git a/conf/parser.go b/conf/parser.go
index bdec888..3e351a7 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -57,15 +57,19 @@ func NewConfig(r io.Reader) *Config {
func (p *parser) startparsing() {
inputmdesc := p.module("input")
fmt.Fprintf(os.Stderr, "input moduledesc: %#v\n", inputmdesc)
- inputfunc, ok := registry.Inputregistry[inputmdesc.name]
+ inputnewfunc, ok := registry.Inputregistry[inputmdesc.name]
if !ok {
fmt.Fprintf(os.Stderr, "input module is not known: %q\n", inputmdesc.name)
}
- inputfunc(nil)
+ inputnewfunc(nil)
filtermdesc := p.module("filter")
fmt.Fprintf(os.Stderr, "filter moduledesc: %#v\n", filtermdesc)
-
+ filternewfunc, ok := registry.Filterregistry[filtermdesc.name]
+ if !ok {
+ fmt.Fprintf(os.Stderr, "filter module is not known: %q\n", filtermdesc.name)
+ }
+ filternewfunc(nil)
}
func (p *parser) advanceOneToken(place string) {