mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-08-12 09:53:39 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92c661354c |
+7
-3
@@ -13,11 +13,15 @@ modules:
|
||||
port: 8000
|
||||
routes:
|
||||
- input: http
|
||||
id: http-to-osc
|
||||
processors:
|
||||
- type: osc.message.create
|
||||
- id: create-osc
|
||||
type: osc.message.create
|
||||
params:
|
||||
address: "{{.Payload.URL.Path}}"
|
||||
- type: osc.message.encode
|
||||
- type: module.output
|
||||
- id: encode-osc
|
||||
type: osc.message.encode
|
||||
- id: output-osc
|
||||
type: module.output
|
||||
params:
|
||||
module: udp
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
type ProcessorConfig struct {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Params Params `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
type RouteConfig struct {
|
||||
Id string `json:"id"`
|
||||
Input string `json:"input"`
|
||||
Processors []ProcessorConfig `json:"processors"`
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type Route struct {
|
||||
id string
|
||||
input string
|
||||
processors []processor.Processor
|
||||
}
|
||||
@@ -32,7 +33,11 @@ func NewRoute(config config.RouteConfig) (*Route, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return &Route{input: config.Input, processors: processors}, nil
|
||||
return &Route{id: config.Id, input: config.Input, processors: processors}, nil
|
||||
}
|
||||
|
||||
func (r *Route) Id() string {
|
||||
return r.id
|
||||
}
|
||||
|
||||
func (r *Route) Input() string {
|
||||
|
||||
@@ -24,11 +24,15 @@ func GetProcessorsSchema() *jsonschema.Schema {
|
||||
ID: proc.Type,
|
||||
Type: "object",
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"id": {
|
||||
Type: "string",
|
||||
MinLength: new(1),
|
||||
},
|
||||
"type": {
|
||||
Const: jsonschema.Ptr[any](proc.Type),
|
||||
},
|
||||
},
|
||||
Required: []string{"type"},
|
||||
Required: []string{"id", "type"},
|
||||
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
|
||||
}
|
||||
if proc.Title != "" {
|
||||
|
||||
@@ -15,6 +15,10 @@ var RoutesConfigSchema = jsonschema.Schema{
|
||||
Items: &jsonschema.Schema{
|
||||
Type: "object",
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"id": {
|
||||
Type: "string",
|
||||
MinLength: new(1),
|
||||
},
|
||||
"input": {
|
||||
Type: "string",
|
||||
MinLength: new(1),
|
||||
@@ -23,7 +27,7 @@ var RoutesConfigSchema = jsonschema.Schema{
|
||||
Ref: "https://showbridge.io/processors.schema.json",
|
||||
},
|
||||
},
|
||||
Required: []string{"input"},
|
||||
Required: []string{"id", "input"},
|
||||
AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
|
||||
},
|
||||
Default: json.RawMessage(`[]`),
|
||||
|
||||
Reference in New Issue
Block a user