Skip to content

Commit

Permalink
Merge pull request #179 from dvonthenen/on-prem-flag-error
Browse files Browse the repository at this point in the history
OnPrem Error Logic Error
  • Loading branch information
davidvonthenen authored Feb 8, 2024
2 parents 5222b80 + fd6e00f commit dea8615
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/client/interfaces/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ func (o *ClientOptions) Parse() error {
klog.V(3).Infof("DEEPGRAM_API_KEY found")
o.ApiKey = v
}
if !o.OnPrem && o.ApiKey == "" {
klog.V(1).Infof("DEEPGRAM_API_KEY not set")
return ErrNoApiKey
}
if v := os.Getenv("DEEPGRAM_HOST"); v != "" {
klog.V(3).Infof("DEEPGRAM_HOST found")
o.Host = v
Expand All @@ -38,6 +34,12 @@ func (o *ClientOptions) Parse() error {
o.OnPrem = strings.EqualFold(strings.ToLower(v), "true")
}

// checks
if !o.OnPrem && o.ApiKey == "" {
klog.V(1).Infof("DEEPGRAM_API_KEY not set")
return ErrNoApiKey
}

// shared
if v := os.Getenv("DEEPGRAM_WEBSOCKET_SKIP_AUTH"); v != "" {
klog.V(3).Infof("DEEPGRAM_WEBSOCKET_SKIP_AUTH found")
Expand Down

0 comments on commit dea8615

Please sign in to comment.