mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
document the change in format of PROXY_CHECKER_INTERVAL
clean up
This commit is contained in:
+4
-7
@@ -33,10 +33,9 @@ type ServerConfig struct {
|
||||
RequestLimit int `env:"PIXIVFE_REQUESTLIMIT"` // if 0, request limit is disabled
|
||||
|
||||
ProxyServer_staging string `env:"PIXIVFE_IMAGEPROXY,overwrite"`
|
||||
ProxyServer url.URL // proxy server, may contain prefix as well
|
||||
ProxyServer url.URL // proxy server URL, may or may not contain authority part of the URL
|
||||
|
||||
ProxyCheckInterval_staging int `env:"PIXIVFE_PROXY_CHECK_INTERVAL,overwrite"`
|
||||
ProxyCheckInterval time.Duration // Proxy check interval
|
||||
ProxyCheckInterval time.Duration `env:"PIXIVFE_PROXY_CHECK_INTERVAL,overwrite"`
|
||||
}
|
||||
|
||||
func (s *ServerConfig) LoadConfig() error {
|
||||
@@ -49,7 +48,7 @@ func (s *ServerConfig) LoadConfig() error {
|
||||
s.UserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:123.0) Gecko/20100101 Firefox/123.0"
|
||||
s.AcceptLanguage = "en-US,en;q=0.5"
|
||||
s.ProxyServer_staging = BuiltinProxyUrl
|
||||
s.ProxyCheckInterval_staging = 480
|
||||
s.ProxyCheckInterval = 8 * time.Hour
|
||||
|
||||
// load config from from env vars
|
||||
if err := envconfig.Process(context.Background(), s); err != nil {
|
||||
@@ -74,9 +73,7 @@ func (s *ServerConfig) LoadConfig() error {
|
||||
log.Panicf("proxy server path (%s) has cannot end in /: %s\nPixivFE does not support this now, sorry", proxyUrl.Path, proxyUrl.String())
|
||||
}
|
||||
}
|
||||
log.Printf("Set %s to: %s\n", "proxy server", &s.ProxyServer)
|
||||
|
||||
s.ProxyCheckInterval = time.Duration(s.ProxyCheckInterval_staging) * time.Minute
|
||||
log.Printf("Proxy server set to: %s\n", s.ProxyServer.String())
|
||||
log.Printf("Proxy check interval set to: %v\n", s.ProxyCheckInterval)
|
||||
|
||||
return nil
|
||||
|
||||
@@ -3,5 +3,4 @@ package config
|
||||
import "time"
|
||||
|
||||
// todo: make this configurable
|
||||
const ExpiresIn = 5 * time.Minute
|
||||
const ProxyCheckerTimeout = 10 * time.Second
|
||||
|
||||
@@ -90,9 +90,10 @@ The value of the `Accept-Language` header used for requests to Pixiv's API. Chan
|
||||
|
||||
**Required**: No
|
||||
|
||||
**Default:** `480`
|
||||
**Default:** `8h`
|
||||
|
||||
The interval in minutes between proxy checks. Defaults to 480 minutes (8 hours) if not set.
|
||||
The interval in minutes between proxy checks. Defaults to 8 hours if not set.
|
||||
Please specify this value in Go's `time.Duration` notation, e.g. `2h3m5s`.
|
||||
You can disable this by setting the value to 0. Then, proxies will only be checked once at server initialization.
|
||||
|
||||
### `PIXIVFE_DEV`
|
||||
|
||||
Reference in New Issue
Block a user