Skip to content

Commit

Permalink
Support connection authentication
Browse files Browse the repository at this point in the history
Fixes #2.
  • Loading branch information
muesli committed Jun 21, 2021
1 parent f0ff87a commit d816742
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
)

var (
host string
port uint32
host string
password string
port uint32

rootCmd = &cobra.Command{
Use: "obs-cli",
Expand All @@ -34,12 +35,13 @@ func main() {
func init() {
cobra.OnInitialize(connectOBS)
rootCmd.PersistentFlags().StringVar(&host, "host", "localhost", "host to connect to")
rootCmd.PersistentFlags().StringVar(&password, "password", "", "password for connection")
rootCmd.PersistentFlags().Uint32VarP(&port, "port", "p", 4444, "port to connect to")
}

func connectOBS() {
var err error
client, err = goobs.New(host + fmt.Sprintf(":%d", port))
client, err = goobs.New(host+fmt.Sprintf(":%d", port), goobs.WithPassword(password))
if err != nil {
fmt.Println("error:", err)
os.Exit(1)
Expand Down

0 comments on commit d816742

Please sign in to comment.