mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
default timeout
This commit is contained in:
5
env.go
5
env.go
@@ -126,6 +126,11 @@ func (e *Environment) Init() error {
|
|||||||
e.Settings.Transformation = "middle-out"
|
e.Settings.Transformation = "middle-out"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default timeout
|
||||||
|
if env.Settings.Timeout <= 0 {
|
||||||
|
env.Settings.Timeout = 300
|
||||||
|
}
|
||||||
|
|
||||||
// create user lookup map
|
// create user lookup map
|
||||||
e.Authentication.lookup = make(map[string]*EnvUser)
|
e.Authentication.lookup = make(map[string]*EnvUser)
|
||||||
|
|
||||||
|
|||||||
@@ -14,19 +14,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func OpenRouterClient() *openrouter.Client {
|
func OpenRouterClient() *openrouter.Client {
|
||||||
timeout := env.Settings.Timeout
|
|
||||||
|
|
||||||
if timeout <= 0 {
|
|
||||||
timeout = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
cc := openrouter.DefaultConfig(env.Tokens.OpenRouter)
|
cc := openrouter.DefaultConfig(env.Tokens.OpenRouter)
|
||||||
|
|
||||||
cc.XTitle = "Whiskr"
|
cc.XTitle = "Whiskr"
|
||||||
cc.HttpReferer = "https://github.com/coalaura/whiskr"
|
cc.HttpReferer = "https://github.com/coalaura/whiskr"
|
||||||
|
|
||||||
cc.HTTPClient = &http.Client{
|
cc.HTTPClient = &http.Client{
|
||||||
Timeout: time.Duration(timeout) * time.Second,
|
Timeout: time.Duration(env.Settings.Timeout) * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
return openrouter.NewClientWithConfig(*cc)
|
return openrouter.NewClientWithConfig(*cc)
|
||||||
|
|||||||
Reference in New Issue
Block a user