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"
// DefaultHTTPTimeout default timeout used when executing http request
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 Property = "files"
)

View file

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

View file

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

View file

@ -55,10 +55,9 @@ func TestLFMSegmentSingle(t *testing.T) {
for _, tc := range cases {
env := &mock.Environment{}
var props properties.Map = properties.Map{
APIKey: "key",
Username: "KibbeWater",
properties.CacheTimeout: 0,
properties.HTTPTimeout: 20000,
APIKey: "key",
Username: "KibbeWater",
properties.HTTPTimeout: 20000,
}
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 {
env := &mock.Environment{}
props := properties.Map{
APIKey: "key",
Location: tc.Location,
Units: "metric",
properties.CacheTimeout: 0,
APIKey: "key",
Location: tc.Location,
Units: "metric",
}
location := url.QueryEscape(tc.Location)
@ -215,10 +214,9 @@ func TestOWMSegmentIcons(t *testing.T) {
o := &Owm{
props: properties.Map{
APIKey: "key",
Location: "AMSTERDAM,NL",
Units: "metric",
properties.CacheTimeout: 0,
APIKey: "key",
Location: "AMSTERDAM,NL",
Units: "metric",
},
env: env,
}
@ -238,10 +236,9 @@ func TestOWMSegmentIcons(t *testing.T) {
o := &Owm{
props: properties.Map{
APIKey: "key",
Location: "AMSTERDAM,NL",
Units: "metric",
properties.CacheTimeout: 0,
APIKey: "key",
Location: "AMSTERDAM,NL",
Units: "metric",
},
env: env,
}

View file

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

View file

@ -27,12 +27,6 @@ import Config from '@site/src/components/Config.js';
"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])
:::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 |
| `parse_kubeconfig` | `boolean` | `true` | parse kubeconfig files instead of calling out to kubectl to improve performance |
| `context_aliases` | `object` | | custom context namespace |
| `cache_timeout` | `int` | `0` | in minutes - how long is the context cached |
## 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,
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={{
"type": "nightscout",
"style": "diamond",
"foreground": "#ffffff",
"background": "#ff0000",
"background_templates": [
"{{ if gt .Sgv 150 }}#FFFF00{{ end }}",
"{{ if lt .Sgv 60 }}#FF0000{{ end }}",
"#00FF00"
],
"foreground_templates": [
"{{ if gt .Sgv 150 }}#000000{{ end }}",
"{{ if lt .Sgv 60 }}#000000{{ end }}",
"#000000"
],
"leading_diamond": "\ue0b6",
"trailing_diamond": "\uE0B0",
"template": "\ue2a1 {{ .Sgv }}{{ .TrendIcon }}",
"properties": {
"url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&token=APITOKENFROMYOURADMIN",
"http_timeout": 1500
}
}}/>
<Config
data={{
type: "nightscout",
style: "diamond",
foreground: "#ffffff",
background: "#ff0000",
background_templates: [
"{{ if gt .Sgv 150 }}#FFFF00{{ end }}",
"{{ if lt .Sgv 60 }}#FF0000{{ end }}",
"#00FF00",
],
foreground_templates: [
"{{ if gt .Sgv 150 }}#000000{{ end }}",
"{{ if lt .Sgv 60 }}#000000{{ end }}",
"#000000",
],
leading_diamond: "\ue0b6",
trailing_diamond: "\uE0B0",
template: "\ue2a1 {{ .Sgv }}{{ .TrendIcon }}",
properties: {
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:
@ -57,12 +59,11 @@ Or display in mmol/l (instead of the default mg/dl) with the following template:
## Properties
| 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 |
| `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 |
| `cache_timeout` | `int` | `5` | in minutes - how long do you want your numbers cached? |
| 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 |
| `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 |
:::info
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
---
import StravaConnect from '/img/strava_connect.svg';
import StravaConnect from "/img/strava_connect.svg";
## 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,
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={{
"type": "strava",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#000000",
"background_templates": [
"{{ if gt .Hours 100 }}#dc3545{{ 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 }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}"
],
"template": " {{.Name}} {{.Ago}} {{.Icon}} ",
"properties": {
"access_token": "11111111111111111",
"refresh_token": "1111111111111111",
"http_timeout": 1500
}
}}/>
<Config
data={{
type: "strava",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#000000",
background_templates: [
"{{ if gt .Hours 100 }}#dc3545{{ 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 }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}",
],
template: " {{.Name}} {{.Ago}} {{.Icon}} ",
properties: {
access_token: "11111111111111111",
refresh_token: "1111111111111111",
http_timeout: 1500,
},
}}
/>
## Properties
| Name | Type | Default | Description |
| Name | Type | Default | Description |
| ----------------------- | :------: | :------: | ------------------------------------------------------------------------------------------------------------- |
| `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. |
| `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? |
| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Strava data cached? |
| `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? |
| `ride_icon` | `string` | `\uf206` | |
| `run_icon` | `string` | `\ue213` | |
| `skiing_icon` | `string` | `\ue213` | |

View file

@ -26,31 +26,32 @@ Click the following link to connect with Withings:
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "withings",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#000000",
"template": "{{ if gt .Weight 0.0 }} {{ round .Weight 2 }}kg {{ end }}",
"properties": {
"access_token": "11111111111111111",
"refresh_token": "1111111111111111",
"http_timeout": 1500
}
}}/>
<Config
data={{
type: "withings",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#000000",
template: "{{ if gt .Weight 0.0 }} {{ round .Weight 2 }}kg {{ end }}",
properties: {
access_token: "11111111111111111",
refresh_token: "1111111111111111",
http_timeout: 1500,
},
}}
/>
## Properties
| Name | Type | Default | Description |
| ---------------- | :------: | :-----: | --------------------------------------------------------------------------------------------- |
| `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. |
| `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? |
| `cache_timeout` | `int` | `5` | in minutes - How long do you want your Withings data cached? |
| Name | Type | Default | Description |
| --------------- | :------: | :-----: | --------------------------------------------------------------------------------------------- |
| `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. |
| `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? |
## 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.
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.
:::
@ -30,7 +30,6 @@ import Config from "@site/src/components/Config.js";
api_key: "<YOUR_API_KEY>",
username: "<LASTFM_USERNAME>",
http_timeout: 20000,
cache_timeout: 1,
},
style: "powerline",
template: ' {{ .Icon }}{{ if ne .Status "stopped" }}{{ .Full }}{{ end }} ',

View file

@ -38,12 +38,11 @@ import Config from "@site/src/components/Config.js";
## Properties
| Name | Type | Default | Description |
| --------------- | :------: | :-------: | ---------------------------------------------------------------------------- |
| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing |
| `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused |
| `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 |
| Name | Type | Default | Description |
| -------------- | :------: | :-------: | ------------------------------ |
| `playing_icon` | `string` | `\uE602 ` | text/icon to show when playing |
| `paused_icon` | `string` | `\uF8E3 ` | text/icon to show when paused |
| `stopped_icon` | `string` | `\uF04D` | text/icon to show when stopped |
## 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])
:::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.
:::
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type":"brewfather",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#33158A",
"background_templates": [
"{{ if and (.Reading) (eq .Status \"Fermenting\") (gt .ReadingAge 4) }}#cc1515{{end}}"
<Config
data={{
type: "brewfather",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#ffffff",
background: "#33158A",
background_templates: [
'{{ if and (.Reading) (eq .Status "Fermenting") (gt .ReadingAge 4) }}#cc1515{{end}}',
],
"properties": {
"user_id":"abcdefg123456",
"api_key":"qrstuvw78910",
"batch_id":"hijklmno098765",
}
}}/>
properties: {
user_id: "abcdefg123456",
api_key: "qrstuvw78910",
batch_id: "hijklmno098765",
},
}}
/>
## Properties
| Name | Type | Default | Description |
| --------------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------- |
| `user_id` | `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 |
| `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 |
| Name | Type | Default | Description |
| -------------- | :------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------- |
| `user_id` | `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 |
| `http_timeout` | `int` | `2` | in milliseconds - How long to wait for the Brewfather service to answer the request |
| `day_icon` | `string` | `d` | icon or letter to use to indicate days |
## Icons

View file

@ -38,17 +38,15 @@ import Config from "@site/src/components/Config.js";
" CO₂ {{ .Index.Icon }}{{ .Actual.String }} {{ .TrendIcon }} {{ .Forecast.String }} ",
properties: {
http_timeout: 5000,
cache_timeout: 10,
},
}}
/>
## Properties
| 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. |
| `cache_timeout` | `int` | `10` | Timeout (in minutes) for the response cache. The default is 10m. A value of 0 disables the cache. |
| 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. |
## Template ([info][templates])

View file

@ -10,29 +10,29 @@ sidebar_label: Ipify
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "ipify",
"style": "diamond",
"foreground": "#ffffff",
"background": "#c386f1",
"leading_diamond": "\ue0b6",
"trailing_diamond": "\uE0B0",
"template": "{{ .IP }}",
"properties": {
"cache_timeout": 5,
"http_timeout": 1000
}
}}/>
<Config
data={{
type: "ipify",
style: "diamond",
foreground: "#ffffff",
background: "#c386f1",
leading_diamond: "\ue0b6",
trailing_diamond: "\uE0B0",
template: "{{ .IP }}",
properties: {
http_timeout: 1000,
},
}}
/>
## Properties
| 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 |
| `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 |
| 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 |
| `http_timeout` | `int` | `20` | in milliseconds - how long may the segment wait for a response of the ipify API |
## Template ([info][templates])

View file

@ -30,20 +30,18 @@ import Config from "@site/src/components/Config.js";
location: "AMSTERDAM,NL",
units: "metric",
http_timeout: 20,
cache_timeout: 10,
},
}}
}}u
/>
## Properties
| 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. |
| `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) |
| `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. |
| 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. |
| `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) |
| `http_timeout` | `int` | `20` | in milliseconds, the timeout for http request |
## Template ([info][templates])

View file

@ -25,7 +25,6 @@ import Config from '@site/src/components/Config.js';
"background": "#007acc",
"properties": {
"url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY",
"cache_timeout": 10,
"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. |
| `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
@ -46,7 +44,6 @@ If you don't want to include the API key into your configuration, the following
"properties": {
// highlight-next-line
"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
}
```