refactor: remove unused cache_timeout references

This commit is contained in:
Jan De Dobbeleer 2024-09-30 14:10:06 +02:00 committed by Jan De Dobbeleer
parent 95d8546a8c
commit 724d25b4ee
19 changed files with 157 additions and 245 deletions

View file

@ -47,10 +47,6 @@ const (
HTTPTimeout Property = "http_timeout" HTTPTimeout Property = "http_timeout"
// DefaultHTTPTimeout default timeout used when executing http request // DefaultHTTPTimeout default timeout used when executing http request
DefaultHTTPTimeout = 20 DefaultHTTPTimeout = 20
// DefaultCacheTimeout default timeout used when caching data
DefaultCacheTimeout = 10
// CacheTimeout cache timeout
CacheTimeout Property = "cache_timeout"
// Files to trigger the segment on // Files to trigger the segment on
Files Property = "files" Files Property = "files"
) )

View file

@ -204,8 +204,7 @@ func TestCarbonIntensitySegmentSingle(t *testing.T) {
for _, tc := range cases { for _, tc := range cases {
env := &mock.Environment{} env := &mock.Environment{}
var props = properties.Map{ var props = properties.Map{
properties.HTTPTimeout: 5000, properties.HTTPTimeout: 5000,
properties.CacheTimeout: 0,
} }
jsonResponse := fmt.Sprintf( jsonResponse := fmt.Sprintf(

View file

@ -164,7 +164,6 @@ func TestKubectlSegment(t *testing.T) {
properties.DisplayError: tc.DisplayError, properties.DisplayError: tc.DisplayError,
ParseKubeConfig: tc.ParseKubeConfig, ParseKubeConfig: tc.ParseKubeConfig,
ContextAliases: tc.ContextAliases, ContextAliases: tc.ContextAliases,
properties.CacheTimeout: 0,
}, },
} }

View file

@ -55,10 +55,9 @@ func TestLFMSegmentSingle(t *testing.T) {
for _, tc := range cases { for _, tc := range cases {
env := &mock.Environment{} env := &mock.Environment{}
var props properties.Map = properties.Map{ var props properties.Map = properties.Map{
APIKey: "key", APIKey: "key",
Username: "KibbeWater", Username: "KibbeWater",
properties.CacheTimeout: 0, properties.HTTPTimeout: 20000,
properties.HTTPTimeout: 20000,
} }
env.On("HTTPRequest", LFMAPIURL).Return([]byte(tc.APIJSONResponse), tc.Error) env.On("HTTPRequest", LFMAPIURL).Return([]byte(tc.APIJSONResponse), tc.Error)

View file

@ -74,10 +74,9 @@ func TestOWMSegmentSingle(t *testing.T) {
for _, tc := range cases { for _, tc := range cases {
env := &mock.Environment{} env := &mock.Environment{}
props := properties.Map{ props := properties.Map{
APIKey: "key", APIKey: "key",
Location: tc.Location, Location: tc.Location,
Units: "metric", Units: "metric",
properties.CacheTimeout: 0,
} }
location := url.QueryEscape(tc.Location) location := url.QueryEscape(tc.Location)
@ -215,10 +214,9 @@ func TestOWMSegmentIcons(t *testing.T) {
o := &Owm{ o := &Owm{
props: properties.Map{ props: properties.Map{
APIKey: "key", APIKey: "key",
Location: "AMSTERDAM,NL", Location: "AMSTERDAM,NL",
Units: "metric", Units: "metric",
properties.CacheTimeout: 0,
}, },
env: env, env: env,
} }
@ -238,10 +236,9 @@ func TestOWMSegmentIcons(t *testing.T) {
o := &Owm{ o := &Owm{
props: properties.Map{ props: properties.Map{
APIKey: "key", APIKey: "key",
Location: "AMSTERDAM,NL", Location: "AMSTERDAM,NL",
Units: "metric", Units: "metric",
properties.CacheTimeout: 0,
}, },
env: env, env: env,
} }

View file

@ -60,12 +60,6 @@
"description": "Cache the executable's version or not", "description": "Cache the executable's version or not",
"default": false "default": false
}, },
"cache_timeout": {
"type": "integer",
"title": "cache timeout",
"description": "Minutes the response is cached. A value of 0 disables the cache.",
"default": 10
},
"expires_in": { "expires_in": {
"type": "integer", "type": "integer",
"title": "Expires in", "title": "Expires in",
@ -943,9 +937,6 @@
"properties": { "properties": {
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
},
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
} }
} }
} }
@ -3095,9 +3086,6 @@
}, },
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
},
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
} }
} }
} }
@ -3282,9 +3270,6 @@
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
}, },
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
},
"access_token": { "access_token": {
"$ref": "#/definitions/access_token" "$ref": "#/definitions/access_token"
}, },
@ -3561,9 +3546,6 @@
}, },
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
},
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
} }
} }
} }
@ -3618,9 +3600,6 @@
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
}, },
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
},
"access_token": { "access_token": {
"$ref": "#/definitions/access_token" "$ref": "#/definitions/access_token"
}, },
@ -3737,12 +3716,6 @@
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
}, },
"cache_timeout": {
"type": "integer",
"title": "cache timeout",
"description": "Minutes the response is cached. A value of 0 disables the cache.",
"default": 5
},
"doubleup_icon": { "doubleup_icon": {
"type": "string", "type": "string",
"title": "Temperature trend icon, very high positive change", "title": "Temperature trend icon, very high positive change",
@ -3848,9 +3821,6 @@
}, },
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
},
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
} }
} }
} }
@ -4029,16 +3999,7 @@
}, },
"then": { "then": {
"title": "Upgrade Segment", "title": "Upgrade Segment",
"description": "https://ohmyposh.dev/docs/segments/system/upgrade", "description": "https://ohmyposh.dev/docs/segments/system/upgrade"
"properties": {
"properties": {
"properties": {
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
}
}
}
}
} }
}, },
{ {
@ -4266,9 +4227,6 @@
}, },
"http_timeout": { "http_timeout": {
"$ref": "#/definitions/http_timeout" "$ref": "#/definitions/http_timeout"
},
"cache_timeout": {
"$ref": "#/definitions/cache_timeout"
} }
} }
} }
@ -4535,19 +4493,7 @@
}, },
"then": { "then": {
"title": "Display GitVersion segment", "title": "Display GitVersion segment",
"description": "https://ohmyposh.dev/docs/segments/cli/gitversion", "description": "https://ohmyposh.dev/docs/segments/cli/gitversion"
"properties": {
"properties": {
"properties": {
"cache_timeout": {
"type": "integer",
"title": "cache timeout",
"description": "Minutes the response is cached. A value of 0 disables the cache.",
"default": 30
}
}
}
}
} }
}, },
{ {
@ -4598,12 +4544,6 @@
"description": "The URL to the Nightscout API", "description": "The URL to the Nightscout API",
"default": "" "default": ""
}, },
"cache_timeout": {
"type": "integer",
"title": "cache timeout",
"description": "Minutes the response is cached. A value of 0 disables the cache.",
"default": 5
},
"http_timeout": { "http_timeout": {
"type": "integer", "type": "integer",
"title": "Http request timeout", "title": "Http request timeout",

View file

@ -27,12 +27,6 @@ import Config from '@site/src/components/Config.js';
"template": " \uF1D2 {{ .MajorMinorPatch }} " "template": " \uF1D2 {{ .MajorMinorPatch }} "
}}/> }}/>
## Properties
| Name | Type | Default | Description |
| --------------- | :---: | :------: | ------------------------------------------------------------------------------------------------------------------------ |
| `cache_timeout` | `int` | `30` | in minutes - How long to wait before fetching new information using the gitversion CLI. A value of 0 disables the cache. |
## Template ([info][templates]) ## Template ([info][templates])
:::note default template :::note default template

View file

@ -35,7 +35,6 @@ import Config from "@site/src/components/Config.js";
| `display_error` | `boolean` | `false` | show the error context when failing to retrieve the kubectl information | | `display_error` | `boolean` | `false` | show the error context when failing to retrieve the kubectl information |
| `parse_kubeconfig` | `boolean` | `true` | parse kubeconfig files instead of calling out to kubectl to improve performance | | `parse_kubeconfig` | `boolean` | `true` | parse kubeconfig files instead of calling out to kubectl to improve performance |
| `context_aliases` | `object` | | custom context namespace | | `context_aliases` | `object` | | custom context namespace |
| `cache_timeout` | `int` | `0` | in minutes - how long is the context cached |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -23,31 +23,33 @@ white text on a yellow background, for example.
The `foreground_templates` example below could be set to just a single color, The `foreground_templates` example below could be set to just a single color,
if that color is visible against any of your backgrounds. if that color is visible against any of your backgrounds.
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "nightscout", data={{
"style": "diamond", type: "nightscout",
"foreground": "#ffffff", style: "diamond",
"background": "#ff0000", foreground: "#ffffff",
"background_templates": [ background: "#ff0000",
"{{ if gt .Sgv 150 }}#FFFF00{{ end }}", background_templates: [
"{{ if lt .Sgv 60 }}#FF0000{{ end }}", "{{ if gt .Sgv 150 }}#FFFF00{{ end }}",
"#00FF00" "{{ if lt .Sgv 60 }}#FF0000{{ end }}",
], "#00FF00",
"foreground_templates": [ ],
"{{ if gt .Sgv 150 }}#000000{{ end }}", foreground_templates: [
"{{ if lt .Sgv 60 }}#000000{{ end }}", "{{ if gt .Sgv 150 }}#000000{{ end }}",
"#000000" "{{ if lt .Sgv 60 }}#000000{{ end }}",
], "#000000",
"leading_diamond": "\ue0b6", ],
"trailing_diamond": "\uE0B0", leading_diamond: "\ue0b6",
"template": "\ue2a1 {{ .Sgv }}{{ .TrendIcon }}", trailing_diamond: "\uE0B0",
"properties": { template: "\ue2a1 {{ .Sgv }}{{ .TrendIcon }}",
"url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&token=APITOKENFROMYOURADMIN", properties: {
"http_timeout": 1500 url: "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&token=APITOKENFROMYOURADMIN",
} http_timeout: 1500,
}}/> },
}}
/>
Or display in mmol/l (instead of the default mg/dl) with the following template: Or display in mmol/l (instead of the default mg/dl) with the following template:
@ -57,12 +59,11 @@ Or display in mmol/l (instead of the default mg/dl) with the following template:
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------- | :-----------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url` | `string` | | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value | | `url` | `string` | | Your Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value |
| `headers` | `map[string]string` | | A key, value map of Headers to send with the request | | `headers` | `map[string]string` | | A key, value map of Headers to send with the request |
| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default | | `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default |
| `cache_timeout` | `int` | `5` | in minutes - how long do you want your numbers cached? |
:::info :::info
You can change the icons for trend, put the trend elsewhere, add text, however you like! You can change the icons for trend, put the trend elsewhere, add text, however you like!

View file

@ -4,7 +4,7 @@ title: Strava
sidebar_label: Strava sidebar_label: Strava
--- ---
import StravaConnect from '/img/strava_connect.svg'; import StravaConnect from "/img/strava_connect.svg";
## What ## What
@ -30,41 +30,42 @@ This configuration sets the background green if you have an activity the last tw
orange if you have one last 5 days, and red otherwise. The `foreground_templates` example below could be set to just a single color, orange if you have one last 5 days, and red otherwise. The `foreground_templates` example below could be set to just a single color,
if that color is visible against any of your backgrounds. if that color is visible against any of your backgrounds.
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "strava", data={{
"style": "powerline", type: "strava",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#000000", foreground: "#ffffff",
"background_templates": [ background: "#000000",
"{{ if gt .Hours 100 }}#dc3545{{ end }}", background_templates: [
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}", "{{ if gt .Hours 100 }}#dc3545{{ end }}",
"{{ if lt .Hours 50 }}#28a745{{ end }}" "{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}",
], "{{ if lt .Hours 50 }}#28a745{{ end }}",
"foreground_templates": [ ],
"{{ if gt .Hours 100 }}#FFFFFF{{ end }}", foreground_templates: [
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}", "{{ if gt .Hours 100 }}#FFFFFF{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}" "{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
], "{{ if lt .Hours 50 }}#FFFFFF{{ end }}",
"template": " {{.Name}} {{.Ago}} {{.Icon}} ", ],
"properties": { template: " {{.Name}} {{.Ago}} {{.Icon}} ",
"access_token": "11111111111111111", properties: {
"refresh_token": "1111111111111111", access_token: "11111111111111111",
"http_timeout": 1500 refresh_token: "1111111111111111",
} http_timeout: 1500,
}}/> },
}}
/>
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| ----------------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------- | | ----------------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------- |
| `access_token` | `string` | | token from Strava login, see login link in section above. | | `access_token` | `string` | | token from Strava login, see login link in section above. |
| `refresh_token` | `string` | | token from Strava login, see login link in section above. | | `refresh_token` | `string` | | token from Strava login, see login link in section above. |
| `expires_in` | `int` | `0` | the default timeout of the token from the Strava login | | `expires_in` | `int` | `0` | the default timeout of the token from the Strava login |
| `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data? | | `http_timeout` | `int` | `500` | in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data? |
| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Strava data cached? |
| `ride_icon` | `string` | `\uf206` | | | `ride_icon` | `string` | `\uf206` | |
| `run_icon` | `string` | `\ue213` | | | `run_icon` | `string` | `\ue213` | |
| `skiing_icon` | `string` | `\ue213` | | | `skiing_icon` | `string` | `\ue213` | |

View file

@ -26,31 +26,32 @@ Click the following link to connect with Withings:
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "withings", data={{
"style": "powerline", type: "withings",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#000000", foreground: "#ffffff",
"template": "{{ if gt .Weight 0.0 }} {{ round .Weight 2 }}kg {{ end }}", background: "#000000",
"properties": { template: "{{ if gt .Weight 0.0 }} {{ round .Weight 2 }}kg {{ end }}",
"access_token": "11111111111111111", properties: {
"refresh_token": "1111111111111111", access_token: "11111111111111111",
"http_timeout": 1500 refresh_token: "1111111111111111",
} http_timeout: 1500,
}}/> },
}}
/>
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| ---------------- | :------: | :-----: | --------------------------------------------------------------------------------------------- | | --------------- | :------: | :-----: | --------------------------------------------------------------------------------------------- |
| `access_token` | `string` | | token from Withings login, see login link in section above. | | `access_token` | `string` | | token from Withings login, see login link in section above. |
| `refresh_token` | `string` | | token from Withings login, see login link in section above. | | `refresh_token` | `string` | | token from Withings login, see login link in section above. |
| `expires_in` | `int` | `0` | the default timeout of the token from the Withings login | | `expires_in` | `int` | `0` | the default timeout of the token from the Withings login |
| `http_timeout` | `int` | `500` | how long do you want to wait before you want to see your prompt more than your Withings data? | | `http_timeout` | `int` | `500` | how long do you want to wait before you want to see your prompt more than your Withings data? |
| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Withings data cached? |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -12,7 +12,7 @@ Show the currently playing song from a [LastFM][lastfm] user.
Be aware that LastFM updates may be severely delayed when paused and songs may linger in the "now playing" state for a prolonged time. Be aware that LastFM updates may be severely delayed when paused and songs may linger in the "now playing" state for a prolonged time.
Additionally, we are using HTTP requests to get the data, Additionally, we are using HTTP requests to get the data,
so you may need to adjust the `http_timeout` and `cache_timeout` to your liking to get better results. so you may need to adjust the `http_timeout` to your liking to get better results.
You **must** request an [API key][api-key] at the LastFM website. You **must** request an [API key][api-key] at the LastFM website.
::: :::
@ -30,7 +30,6 @@ import Config from "@site/src/components/Config.js";
api_key: "<YOUR_API_KEY>", api_key: "<YOUR_API_KEY>",
username: "<LASTFM_USERNAME>", username: "<LASTFM_USERNAME>",
http_timeout: 20000, http_timeout: 20000,
cache_timeout: 1,
}, },
style: "powerline", style: "powerline",
template: ' {{ .Icon }}{{ if ne .Status "stopped" }}{{ .Full }}{{ end }} ', template: ' {{ .Icon }}{{ if ne .Status "stopped" }}{{ .Full }}{{ end }} ',

View file

@ -38,12 +38,11 @@ import Config from "@site/src/components/Config.js";
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :------: | :-------: | ---------------------------------------------------------------------------- | | -------------- | :------: | :-------: | ------------------------------ |
| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing | | `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing |
| `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused | | `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused |
| `stopped_icon` | `string` | `\uF04D` | text/icon to show when stopped | | `stopped_icon` | `string` | `\uF04D` | text/icon to show when stopped |
| `cache_timeout` | `int` | `0` | **macOS only** in minutes - How long to wait before fetching new information |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -21,12 +21,6 @@ import Config from "@site/src/components/Config.js";
}} }}
/> />
## Properties
| Name | Type | Default | Description |
| --------------- | :---: | :-----: | ------------------------------------------------------------------------------------- |
| `cache_timeout` | `int` | `10080` | in minutes - how long to wait before checking for a new version. Default is one week. |
## Template ([info][templates]) ## Template ([info][templates])
:::note default template :::note default template

View file

@ -23,34 +23,35 @@ an issue if, for example there is a Tilt or similar device that is supposed to b
Temperature units are in degrees C and specific gravity is expressed as `X.XXX` values. Temperature units are in degrees C and specific gravity is expressed as `X.XXX` values.
::: :::
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type":"brewfather", data={{
"style": "powerline", type: "brewfather",
"powerline_symbol": "\uE0B0", style: "powerline",
"foreground": "#ffffff", powerline_symbol: "\uE0B0",
"background": "#33158A", foreground: "#ffffff",
"background_templates": [ background: "#33158A",
"{{ if and (.Reading) (eq .Status \"Fermenting\") (gt .ReadingAge 4) }}#cc1515{{end}}" background_templates: [
'{{ if and (.Reading) (eq .Status "Fermenting") (gt .ReadingAge 4) }}#cc1515{{end}}',
], ],
"properties": { properties: {
"user_id":"abcdefg123456", user_id: "abcdefg123456",
"api_key":"qrstuvw78910", api_key: "qrstuvw78910",
"batch_id":"hijklmno098765", batch_id: "hijklmno098765",
} },
}}/> }}
/>
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------- | | -------------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------- |
| `user_id` | `string` | | as provided by Brewfather's Generate API Key screen | | `user_id` | `string` | | as provided by Brewfather's Generate API Key screen |
| `api_key` | `string` | | as provided by Brewfather's Generate API Key screen | | `api_key` | `string` | | as provided by Brewfather's Generate API Key screen |
| `batch_id` | `string` | | Get this by navigating to the desired batch on the brewfather website, the batch id is at the end of the URL in the address bar | | `batch_id` | `string` | | Get this by navigating to the desired batch on the brewfather website, the batch id is at the end of the URL in the address bar |
| `http_timeout` | `int` | `2` | in milliseconds - How long to wait for the Brewfather service to answer the request | | `http_timeout` | `int` | `2` | in milliseconds - How long to wait for the Brewfather service to answer the request |
| `cache_timeout` | `int` | `5` | in minutes - How long to wait before updating the data from Brewfather | | `day_icon` | `string` | `d` | icon or letter to use to indicate days |
| `day_icon` | `string` | `d` | icon or letter to use to indicate days |
## Icons ## Icons

View file

@ -38,17 +38,15 @@ import Config from "@site/src/components/Config.js";
" CO₂ {{ .Index.Icon }}{{ .Actual.String }} {{ .TrendIcon }} {{ .Forecast.String }} ", " CO₂ {{ .Index.Icon }}{{ .Actual.String }} {{ .TrendIcon }} {{ .Forecast.String }} ",
properties: { properties: {
http_timeout: 5000, http_timeout: 5000,
cache_timeout: 10,
}, },
}} }}
/> />
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :---: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------ | | -------------- | :---: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `http_timeout` | `int` | `20` | Timeout (in milliseconds) for HTTP requests. The default is 20ms, but you may need to set this to as high as 5000ms to handle slow API requests. | | `http_timeout` | `int` | `20` | Timeout (in milliseconds) for HTTP requests. The default is 20ms, but you may need to set this to as high as 5000ms to handle slow API requests. |
| `cache_timeout` | `int` | `10` | Timeout (in minutes) for the response cache. The default is 10m. A value of 0 disables the cache. |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -10,29 +10,29 @@ sidebar_label: Ipify
## Sample Configuration ## Sample Configuration
import Config from '@site/src/components/Config.js'; import Config from "@site/src/components/Config.js";
<Config data={{ <Config
"type": "ipify", data={{
"style": "diamond", type: "ipify",
"foreground": "#ffffff", style: "diamond",
"background": "#c386f1", foreground: "#ffffff",
"leading_diamond": "\ue0b6", background: "#c386f1",
"trailing_diamond": "\uE0B0", leading_diamond: "\ue0b6",
"template": "{{ .IP }}", trailing_diamond: "\uE0B0",
"properties": { template: "{{ .IP }}",
"cache_timeout": 5, properties: {
"http_timeout": 1000 http_timeout: 1000,
} },
}}/> }}
/>
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :------: | :---------------------: | ------------------------------------------------------------------------------- | | -------------- | :------: | :---------------------: | ------------------------------------------------------------------------------- |
| `url` | `string` | `https://api.ipify.org` | The Ipify URL, by default IPv4 is used, use `https://api64.ipify.org` for IPv6 | | `url` | `string` | `https://api.ipify.org` | The Ipify URL, by default IPv4 is used, use `https://api64.ipify.org` for IPv6 |
| `http_timeout` | `int` | `20` | in milliseconds - how long may the segment wait for a response of the ipify API | | `http_timeout` | `int` | `20` | in milliseconds - how long may the segment wait for a response of the ipify API |
| `cache_timeout` | `int` | `10` | in minutes - How long you want your IP address cached |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -30,20 +30,18 @@ import Config from "@site/src/components/Config.js";
location: "AMSTERDAM,NL", location: "AMSTERDAM,NL",
units: "metric", units: "metric",
http_timeout: 20, http_timeout: 20,
cache_timeout: 10,
}, },
}} }}u
/> />
## Properties ## Properties
| Name | Type | Default | Description | | Name | Type | Default | Description |
| --------------- | :------: | :----------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -------------- | :------: | :----------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key` | `string` | `.` | Your API key from [Open Weather Map][owm]. Can also be set using the `POSH_OWM_API_KEY` environment variable. | | `api_key` | `string` | `.` | Your API key from [Open Weather Map][owm]. Can also be set using the `POSH_OWM_API_KEY` environment variable. |
| `location` | `string` | `De Bilt,NL` | The requested location interpreted only if valid coordinates aren't given. Formatted as \<City,STATE,COUNTRY_CODE\>. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes | | `location` | `string` | `De Bilt,NL` | The requested location interpreted only if valid coordinates aren't given. Formatted as \<City,STATE,COUNTRY_CODE\>. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes |
| `units` | `string` | `standard` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) | | `units` | `string` | `standard` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) |
| `http_timeout` | `int` | `20` | in milliseconds, the timeout for http request | | `http_timeout` | `int` | `20` | in milliseconds, the timeout for http request |
| `cache_timeout` | `int` | `10` | in minutes, the timeout for request caching. A value of 0 disables the cache. |
## Template ([info][templates]) ## Template ([info][templates])

View file

@ -25,7 +25,6 @@ import Config from '@site/src/components/Config.js';
"background": "#007acc", "background": "#007acc",
"properties": { "properties": {
"url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY", "url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY",
"cache_timeout": 10,
"http_timeout": 500 "http_timeout": 500
} }
}}/> }}/>
@ -36,7 +35,6 @@ import Config from '@site/src/components/Config.js';
| --------------- | :-------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --------------- | :-------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url` | `string` | | The Wakatime [summaries][wk-summaries] URL, including the API key. Example above. | | `url` | `string` | | The Wakatime [summaries][wk-summaries] URL, including the API key. Example above. |
| `http_timeout` | `int` | `20` | The time (_in milliseconds_, `ms`) it takes to consider an http request as **timed-out**. If no segment is shown, try increasing this timeout. | | `http_timeout` | `int` | `20` | The time (_in milliseconds_, `ms`) it takes to consider an http request as **timed-out**. If no segment is shown, try increasing this timeout. |
| `cache_timeout` | `int` | `10` | The time (_in minutes_, `m`) it takes to invalidate/renew the Wakatime segment output. Setting this to `0` disables the cache and requests to the API everytime the user presses the Enter key. |
### Dynamic API Key ### Dynamic API Key
@ -46,7 +44,6 @@ If you don't want to include the API key into your configuration, the following
"properties": { "properties": {
// highlight-next-line // highlight-next-line
"url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key={{ .Env.WAKATIME_API_KEY }}", "url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key={{ .Env.WAKATIME_API_KEY }}",
"cache_timeout": 10,
"http_timeout": 500 "http_timeout": 500
} }
``` ```