aboutsummaryrefslogblamecommitdiff
path: root/connector/external/config.go
blob: 03e1feb24fc578a0a2985f369366035cec14424e (plain) (tree)
1
2
3
4
5


                

            




























                                                                    
                                                                                              













                                                             





                                                                                                         


                  
package external

import (
	"os"

	. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
)

const DUMMYEXT_PROTOCOL = "DummyExt"
const MESSENGER_PROTOCOL = "Messenger"

func init() {
	Register(DUMMYEXT_PROTOCOL, Protocol{
		NewConnector: func() Connector {
			return &External{
				protocol: DUMMYEXT_PROTOCOL,
				command:  "./external/dummy.py",
				debug:    true,
			}
		},
		Schema: ConfigSchema{
			&ConfigEntry{
				Name:        "user",
				Description: "Username",
				Required:    true,
			},
		},
	})

	Register(MESSENGER_PROTOCOL, Protocol{
		NewConnector: func() Connector {
			return &External{
				protocol: MESSENGER_PROTOCOL,
				command:  "./external/messenger.py",
				debug:    (os.Getenv("EASYBRIDGE_MESSENGER_DEBUG") == "true"),
			}
		},
		Schema: ConfigSchema{
			&ConfigEntry{
				Name:        "email",
				Description: "Email address",
				Required:    true,
			},
			&ConfigEntry{
				Name:        "password",
				Description: "Password",
				IsPassword:  true,
				Required:    true,
			},
			&ConfigEntry{
				Name:        "initial_backlog",
				Description: "Maximum number of messages to load when joining a channel",
				IsNumeric:   true,
				Default:     "100",
			},
		},
	})
}