diff --git a/entry/cli/client.go b/entry/cli/client.go index bfbabf2..8effefa 100644 --- a/entry/cli/client.go +++ b/entry/cli/client.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "git.nspix.com/golang/kos/util/env" "github.com/peterh/liner" "io" "math" @@ -240,14 +241,22 @@ func (client *Client) Close() (err error) { } func NewClient(ctx context.Context, addr string) *Client { + var ( + err error + timeout time.Duration + ) if ctx == nil { ctx = context.Background() } + duration := env.Get("VOX_TIMEOUT", "30s") + if timeout, err = time.ParseDuration(duration); err != nil { + timeout = time.Second * 30 + } return &Client{ ctx: ctx, address: addr, name: filepath.Base(os.Args[0]), - Timeout: time.Second * 30, + Timeout: timeout, liner: liner.NewLiner(), readyChan: make(chan struct{}, 1), exitChan: make(chan struct{}),