4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-27 04:09:24 +00:00

Use viper (github.com/spf13/viper) for configuration

This commit is contained in:
Wim
2018-03-04 23:52:14 +01:00
parent 25a72113b1
commit f2f1d874e1
15 changed files with 364 additions and 336 deletions

View File

@ -14,18 +14,18 @@ import (
type Bsshchat struct {
r *bufio.Scanner
w io.WriteCloser
*config.BridgeConfig
*bridge.Config
}
func New(cfg *config.BridgeConfig) bridge.Bridger {
return &Bsshchat{BridgeConfig: cfg}
func New(cfg *bridge.Config) bridge.Bridger {
return &Bsshchat{Config: cfg}
}
func (b *Bsshchat) Connect() error {
var err error
b.Log.Infof("Connecting %s", b.Config.Server)
b.Log.Infof("Connecting %s", b.GetString("Server"))
go func() {
err = sshd.ConnectShell(b.Config.Server, b.Config.Nick, func(r io.Reader, w io.WriteCloser) error {
err = sshd.ConnectShell(b.GetString("Server"), b.GetString("Nick"), func(r io.Reader, w io.WriteCloser) error {
b.r = bufio.NewScanner(r)
b.w = w
b.r.Scan()