hasshelper/screen/server.go
2022-08-19 12:35:43 -05:00

28 lines
570 B
Go

package screen
import (
"github.com/rs/zerolog"
"github.com/spf13/viper"
)
type configObj struct {
logger zerolog.Logger
brokerUrl string
clientId string
topic string
}
var config = configObj{}
func init() {
viper.SetDefault("mqtt_client_id", "screenlistener")
}
func Run(rootLogger zerolog.Logger, exitch chan bool) {
config.logger = rootLogger.With().Str("name", "screen").Logger()
config.brokerUrl = viper.GetString("mqtt_url")
config.clientId = viper.GetString("mqtt_client_id")
config.topic = viper.GetString("mqtt_topic")
exitch <- true
}