72 lines
1.5 KiB
Go
72 lines
1.5 KiB
Go
|
package mapping
|
||
|
|
||
|
type Mapping struct {
|
||
|
Sources []MapItem
|
||
|
Sinks []MapItem
|
||
|
Mappings []MapPair
|
||
|
}
|
||
|
|
||
|
type MapPair struct {
|
||
|
From string
|
||
|
To string
|
||
|
}
|
||
|
|
||
|
type MapItem struct {
|
||
|
Name string
|
||
|
Type string
|
||
|
Config map[string]string
|
||
|
}
|
||
|
|
||
|
// TODO: Make a web interface to configure these horrible structures
|
||
|
func Example() Mapping {
|
||
|
mappings := Mapping{}
|
||
|
|
||
|
webshit := MapItem{
|
||
|
Name: "webshit",
|
||
|
Type: "RSS",
|
||
|
Config: map[string]string{
|
||
|
"prefix": "/rss/webshit",
|
||
|
"URL": "http://n-gate.com/hackernews/index.rss",
|
||
|
},
|
||
|
}
|
||
|
mappings.Sources = append(mappings.Sources, webshit)
|
||
|
genericRest := MapItem{
|
||
|
Name: "GenericRest",
|
||
|
Type: "GenericRest",
|
||
|
Config: map[string]string{
|
||
|
"prefix": "/rest",
|
||
|
"name": "GenericRest",
|
||
|
},
|
||
|
}
|
||
|
mappings.Sources = append(mappings.Sources, genericRest)
|
||
|
consoleZero := MapItem{
|
||
|
Name: "Console-00",
|
||
|
Type: "Console",
|
||
|
Config: map[string]string{
|
||
|
"ID": "00",
|
||
|
},
|
||
|
}
|
||
|
mappings.Sinks = append(mappings.Sinks, consoleZero)
|
||
|
consoleOne := MapItem{
|
||
|
Name: "Console-01",
|
||
|
Type: "Console",
|
||
|
Config: map[string]string{
|
||
|
"ID": "01",
|
||
|
},
|
||
|
}
|
||
|
mappings.Sinks = append(mappings.Sinks, consoleOne)
|
||
|
|
||
|
pushOver := MapItem{
|
||
|
Name: "Pushover",
|
||
|
Type: "Pushover",
|
||
|
Config: map[string]string{},
|
||
|
}
|
||
|
mappings.Sinks = append(mappings.Sinks, pushOver)
|
||
|
|
||
|
mappings.Mappings = append(mappings.Mappings, MapPair{"GenericRest", "Console-00"})
|
||
|
mappings.Mappings = append(mappings.Mappings, MapPair{"GenericRest", "Console-01"})
|
||
|
mappings.Mappings = append(mappings.Mappings, MapPair{"webshit", "Pushover"})
|
||
|
|
||
|
return mappings
|
||
|
}
|