diff --git a/.all-contributorsrc b/.all-contributorsrc index 2b010f34..8a739c70 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -273,14 +273,20 @@ "name": "Federico Ruggi", "avatar_url": "https://avatars2.githubusercontent.com/u/1081051?v=4", "profile": "https://github.com/ruggi", - "contributions": [ - ] + "contributions": [] }, { "login": "ctwoodward", "name": "Craig Woodward", "avatar_url": "https://avatars2.githubusercontent.com/u/7293328?v=4", "profile": "https://github.com/ctwoodward", + "contributions": [] + }, + { + "login": "ReadmeCritic", + "name": "ReadmeCritic", + "avatar_url": "https://avatars3.githubusercontent.com/u/15367484?v=4", + "profile": "https://twitter.com/ReadmeCritic", "contributions": [ ] }, diff --git a/.gitignore b/.gitignore index 6dde8d37..326dd4bb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.exe *.exe~ *.dll +ftw* *.so *.dylib diff --git a/.travis.yml b/.travis.yml index f8b7c5df..05f6591d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ before_install: - export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/senorprogrammer/wtf - cd $HOME/gopath/src/github.com/senorprogrammer/wtf -script: go get ./... && go get github.com/go-test/deep && go test -v github.com/senorprogrammer/wtf/wtftests/... +script: go get ./... && go get github.com/go-test/deep && go test -v github.com/senorprogrammer/wtf/wtf_tests/... diff --git a/README.md b/README.md index f399486e..73110bc3 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Thanks goes to these wonderful people: | [
flw](http://flw.tools/)
| [
David Barda](https://github.com/davebarda)
| [
Geoff Lee](https://github.com/matrinox)
| [
George Opritescu](http://international.github.io)
| [
Grazfather](https://twitter.com/Grazfather)
| [
Michael Cordell](http://www.mikecordell.com/)
| [
Patrick José Pereira](http://patrick.ibexcps.com)
| | [
sherod taylor](https://github.com/sherodtaylor)
| [
Andrew Scott](http://cogentia.io)
| [
Anand Sudhir Prayaga](https://github.com/anandsudhir)
| [
Lassi Piironen](https://github.com/lsipii)
| [
BlackWebWolf](https://github.com/BlackWebWolf)
| [
andrewzolotukhin](https://github.com/andrewzolotukhin)
| [
Leon Stigter](https://retgits.github.io)
| | [
Amr Tamimi](https://tamimi.se)
| [
Jagdeep Singh](https://jagdeep.me)
| [
Lineu Felipe](https://github.com/darkSasori)
| [
Konstantin](https://github.com/kvj)
| [
Brendan O'Leary](http://www.brendanoleary.com)
| [
bertl4398](https://github.com/bertl4398)
| [
Ferenc-](https://github.com/Ferenc-)
| -| [
Rohan Verma](http://rohanverma.net)
| [
Tim Fitzgerald](https://github.com/fimtitzgerald)
| [
Federico Ruggi](https://github.com/ruggi)
| [
Craig Woodward](https://github.com/ctwoodward)
| +| [
Rohan Verma](http://rohanverma.net)
| [
Tim Fitzgerald](https://github.com/fimtitzgerald)
| [
Federico Ruggi](https://github.com/ruggi)
| [
Craig Woodward](https://github.com/ctwoodward)
| [
ReadmeCritic](https://twitter.com/ReadmeCritic)
| This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/_site/content/posts/modules/bamboohr.md b/_site/content/posts/modules/bamboohr.md index 2ca3e35f..6d75f242 100644 --- a/_site/content/posts/modules/bamboohr.md +++ b/_site/content/posts/modules/bamboohr.md @@ -12,14 +12,6 @@ Connects to the BambooHR API and displays who will be Away today. wtf/bamboohr/ ``` -## Required ENV Variables - -Key: `WTF_BAMBOO_HR_TOKEN`
-Value: Your BambooHR API token. - -Key: `WTF_BAMBOO_HR_SUBDOMAIN`
-Value: Your BambooHR API subdomain name. - ## Keyboard Commands None. @@ -28,6 +20,7 @@ None. ```yaml bamboohr: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 0 @@ -35,12 +28,16 @@ bamboohr: height: 2 width: 1 refreshInterval: 900 + subdomain: "testco" ``` ### Attributes +`apiKey`
+Value: Your BambooHR API token. + `enabled`
-Determines whether or not this module is executed and if its data displayed onscreen.
+Whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. `position`
@@ -49,3 +46,6 @@ Defines where in the grid this module's widget will be displayed.
`refreshInterval`
How often, in seconds, this module will update its data.
Values: Any positive integer, `0..n`. + +`subdomain`
+Value: Your BambooHR API subdomain name. diff --git a/_site/content/posts/modules/circleci.md b/_site/content/posts/modules/circleci.md index 4a2df2d9..351a54de 100644 --- a/_site/content/posts/modules/circleci.md +++ b/_site/content/posts/modules/circleci.md @@ -16,12 +16,6 @@ Displays build information for your CircleCI account. wtf/circleci/ ``` -## Required ENV Variables - -Key: `WTF_CIRCLE_API_KEY`
-Value: Your CircleCI API -token. - ## Keyboard Commands None. @@ -30,6 +24,7 @@ None. ```yaml circleci: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 4 @@ -41,6 +36,9 @@ circleci: ### Attributes +`apiKey`
+Value: Your CircleCI API token. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/gerrit.md b/_site/content/posts/modules/gerrit.md index e2b4837e..1b9fd1be 100644 --- a/_site/content/posts/modules/gerrit.md +++ b/_site/content/posts/modules/gerrit.md @@ -4,8 +4,6 @@ date: 2018-06-27T15:55:42-07:00 draft: false --- -gerrit screenshot - Displays information about your projects hosted on Gerrit: #### Open Incoming Reviews @@ -16,17 +14,14 @@ All open reviews that are requesting your approval. All open reviews created by you. +gerrit screenshot + ## Source Code ```bash wtf/gerrit/ ``` -## Required ENV Variables - -Key: `WTF_GERRIT_PASSWORD`
-Action: Your Gerrit HTTP Password. - ## Keyboard Commands Key: `/`
@@ -59,6 +54,7 @@ gerrit: projects: - org/test-project" - dotfiles + password: "mypassword" username: "myname" verifyServerCertificate: false ``` @@ -83,8 +79,11 @@ Values: A valid URI. `projects`
A list of Gerrit project names to fetch data for.
+`password`
+Value: Your Gerrit HTTP Password. + `username`
-Your Gerrit username.
+Your Gerrit username. `verifyServerCertificate`
_Optional_
diff --git a/_site/content/posts/modules/github.md b/_site/content/posts/modules/github.md index 3c54b776..bc80f930 100644 --- a/_site/content/posts/modules/github.md +++ b/_site/content/posts/modules/github.md @@ -23,22 +23,6 @@ All open pull requests created by you. wtf/github/ ``` -## GitHub Required ENV Variables - -Key: `WTF_GITHUB_TOKEN`
-Action: Your GitHub API token. - -## GitHub Enterprise Required ENV Variables - -Key: `WTF_GITHUB_TOKEN`
-Action: Your GitHub API token. - -Key: `WTF_GITHUB_BASE_URL`
-Action: Your GitHub Enterprise API URL. - -Key: `WTF_GITHUB_UPLOAD_URL`
-Action: Your GitHub Enterprise upload URL (often the same as API URL). - ## Keyboard Commands Key: `/`
@@ -60,6 +44,8 @@ wtf/github/ ```yaml github: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" + baseURL: "" enabled: true enableStatus: true position: @@ -71,13 +57,21 @@ github: repositories: wesker-api: "UmbrellaCorp" wtf: "senorprogrammer" + uploadURL: "" username: "senorprogrammer" ``` ### Attributes +`apiKey`
+Value: Your GitHub API token. + +`baseURL`
+_Optional_
+Value: Your GitHub Enterprise API URL. + `enabled`
-Determines whether or not this module is executed and if its data displayed onscreen.
+Whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. `enableStatus`
@@ -98,6 +92,10 @@ for.
Key: The name of the repository.
Value: The name of the account or organization that owns the repository. +`uploadURL`
+_Optional_
+Value: Your GitHub Enterprise upload URL (often the same as API URL). + `username`
Your GitHub username. Used to figure out which review requests you've been added to. diff --git a/_site/content/posts/modules/gitlab.md b/_site/content/posts/modules/gitlab.md index 1e48abe0..671dfe74 100644 --- a/_site/content/posts/modules/gitlab.md +++ b/_site/content/posts/modules/gitlab.md @@ -24,11 +24,6 @@ All open merge requests created by you. wtf/gitlab/ ``` -## Required ENV Variables - -Key: `WTF_GITLAB_TOKEN`
-Action: A GitLab personal access token. Requires at least `api` access. - ## Keyboard Commands Key: `/`
@@ -50,6 +45,7 @@ wtf/gitlab/ ```yaml gitlab: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 2 @@ -65,6 +61,9 @@ gitlab: ### Attributes +`apiKey`
+Value: A GitLab personal access token. Requires at least `api` access. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/jenkins.md b/_site/content/posts/modules/jenkins.md index 326420c7..d2577979 100644 --- a/_site/content/posts/modules/jenkins.md +++ b/_site/content/posts/modules/jenkins.md @@ -17,11 +17,6 @@ width="320" height="68" alt="jenkins screenshot" /> wtf/jenkins/ ``` -## Required ENV Variables - -Key: `WTF_JENKINS_API_KEY`
-Value: Your Jenkins API key. - ## Keyboard Commands None. @@ -30,6 +25,7 @@ None. ```yaml jenkins: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 2 @@ -44,6 +40,9 @@ jenkins: ### Attributes +`apiKey`
+Value: Your Jenkins API key. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/jira.md b/_site/content/posts/modules/jira.md index 081f4a31..71a6f988 100644 --- a/_site/content/posts/modules/jira.md +++ b/_site/content/posts/modules/jira.md @@ -14,11 +14,6 @@ Displays all Jira issues assigned to you for the specified project. wtf/jira/ ``` -## Required ENV Variables - -Key: `WTF_JIRA_API_KEY`
-Value: Your Jira API key. - ## Keyboard Commands Key: `[return]`
@@ -42,6 +37,7 @@ wtf/jira/ ```yaml jira: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" colors: rows: even: "lightblue" @@ -68,6 +64,7 @@ configuration (note the difference in `project`): ```yaml jira: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" colors: rows: even: "lightblue" @@ -89,6 +86,9 @@ jira: ### Attributes +`apiKey`
+Value: Your Jira API key. + `colors.rows.even`
Define the foreground color for even-numbered rows.
Values: Any X11 diff --git a/_site/content/posts/modules/newrelic.md b/_site/content/posts/modules/newrelic.md index e7eb1fbc..9d2881d3 100644 --- a/_site/content/posts/modules/newrelic.md +++ b/_site/content/posts/modules/newrelic.md @@ -15,12 +15,6 @@ monitored application: deploy ID, deploy time, and who deployed it. wtf/newrelic/ ``` -## Required ENV Variables - -Key: `WTF_NEW_RELIC_API_KEY`
-Value: Your
New Relic API -token. - ## Keyboard Commands None. @@ -29,6 +23,7 @@ None. ```yaml newrelic: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" applicationId: 10549735 deployCount: 6 enabled: true @@ -42,6 +37,9 @@ newrelic: ### Attributes +`apiKey`
+Value: Your New Relic API token. + `applicationId`
The integer ID of the New Relic application you wish to report on.
diff --git a/_site/content/posts/modules/opsgenie.md b/_site/content/posts/modules/opsgenie.md index 5d34d4be..ac18411b 100644 --- a/_site/content/posts/modules/opsgenie.md +++ b/_site/content/posts/modules/opsgenie.md @@ -15,12 +15,6 @@ and who's currently on call. wtf/opsgenie/ ``` -## Required ENV Variables - -Key: `WTF_OPS_GENIE_API_KEY`
-Value: Your OpsGenie -API token. - ## Keyboard Commands None. @@ -29,6 +23,7 @@ None. ```yaml opsgenie: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" displayEmpty: false enabled: true position: @@ -41,6 +36,9 @@ opsgenie: ### Attributes +`apiKey` < br /> +Value: Your OpsGenie API token. + `displayEmpty`
Whether schedules with no assigned person on-call should be displayed.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/todoist.md b/_site/content/posts/modules/todoist.md index 9381b5b8..9326313d 100644 --- a/_site/content/posts/modules/todoist.md +++ b/_site/content/posts/modules/todoist.md @@ -16,13 +16,6 @@ Displays all items on specified project. wtf/todoist/ ``` -## Required ENV Variables - -Key: `WTF_TODOIST_TOKEN`
-Value: Your Todoist API Token.
- -_You can get your API Token at: todoist.com/prefs/integrations._ - ## Keyboard Commands Key: `h`
@@ -62,6 +55,7 @@ _You can get your API Token at: todoist.com/prefs/integrations._ ```yaml todoist: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 0 @@ -75,6 +69,9 @@ todoist: ### Attributes +`apiKey`
+Value: Your Todoist API token. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/travisci.md b/_site/content/posts/modules/travisci.md index dcb5eebf..e162c9a6 100644 --- a/_site/content/posts/modules/travisci.md +++ b/_site/content/posts/modules/travisci.md @@ -16,11 +16,6 @@ Displays build information for your Travis CI account. wtf/travisci/ ``` -## Required ENV Variables - -Key: `WTF_TRAVIS_API_TOKEN`
-Value: Your Travis CI API access token. - ## Keyboard Commands None. @@ -29,6 +24,7 @@ None. ```yaml travisci: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 4 @@ -41,6 +37,9 @@ travisci: ### Attributes +`apiKey`
+Value: Your Travis CI API access token. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/trello.md b/_site/content/posts/modules/trello.md index c8649b69..88ec787d 100644 --- a/_site/content/posts/modules/trello.md +++ b/_site/content/posts/modules/trello.md @@ -14,15 +14,6 @@ Displays all Trello cards on specified lists. wtf/trello/ ``` -## Required ENV Variables - -Key: `WTF_TRELLO_APP_KEY`
-Value: Your Trello App Key.
-Key: `WTF_TRELLO_ACCESS_TOKEN`
-Value: Your Trello Access Token.
- -_You can get your API key at: trello.com/app-key._ - ## Keyboard Commands None. @@ -32,11 +23,13 @@ None. ### Single Trello List ```yaml -trello: +trello: + accessToken: "7b8b14f8743a408a93276d7155dd9ee2" + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" board: Main enabled: true list: "Todo" - position: + position: height: 1 left: 2 top: 0 @@ -51,11 +44,13 @@ If you want to monitor multiple Trello lists, use the following configuration (note the difference in `list`): ```yaml -trello: +trello: + accessToken: "7b8b14f8743a408a93276d7155dd9ee2" + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" board: Main enabled: true list: ["Todo", "Done"] - position: + position: height: 1 left: 2 top: 0 @@ -66,6 +61,12 @@ trello: ### Attributes +`accessToken`
+Value: Your Trello access token. + +`apiKey`
+Value: Your Trello API key. + `board`
The name of the Trello board.
diff --git a/_site/content/posts/modules/zendesk.md b/_site/content/posts/modules/zendesk.md index a86479af..b7e9ea16 100644 --- a/_site/content/posts/modules/zendesk.md +++ b/_site/content/posts/modules/zendesk.md @@ -14,14 +14,6 @@ Displays tickets in the "New" status - i.e. have not yet been assigned. wtf/zendesk/ ``` -## Required ENV Variables - -Key: `ZENDESK_API`
-Value: Your Zendesk API Token - -Key: `ZENDESK_DOMAIN`
-Value: Your Zendesk subdomain - ## Keyboard Commands Key: `[return]`
@@ -43,6 +35,7 @@ wtf/zendesk/ ```yaml zendesk: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 0 @@ -50,11 +43,15 @@ zendesk: height: 1 width: 1 status: "new" + subdomain: "your_domain" username: "your_email@acme.com" ``` ### Attributes +`apiKey`
+Value: Your Zendesk API token. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. @@ -66,6 +63,9 @@ Defines where in the grid this module's widget will be displayed.
The status of tickets you want to retrieve. Values: `new`, `open`, `pending`, `hold`. +`subdomain`
+Value: Your Zendesk subdomain. + `username`
Your Zendesk username Values: A valid Zendesk username (usually an email address). diff --git a/_site/static/imgs/modules/gerrit.png b/_site/static/imgs/modules/gerrit.png index 6084dc1d..8b472e5c 100644 Binary files a/_site/static/imgs/modules/gerrit.png and b/_site/static/imgs/modules/gerrit.png differ diff --git a/bamboohr/client.go b/bamboohr/client.go index fd8664d0..1cebd95d 100644 --- a/bamboohr/client.go +++ b/bamboohr/client.go @@ -4,6 +4,8 @@ import ( "encoding/xml" "fmt" "os" + + "github.com/senorprogrammer/wtf/wtf" ) // A Client represents the data required to connect to the BambooHR API @@ -16,11 +18,11 @@ type Client struct { // NewClient creates and returns a new BambooHR client func NewClient(url string) *Client { client := Client{ - apiBase: url, - apiKey: os.Getenv("WTF_BAMBOO_HR_TOKEN"), - subdomain: os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN"), + apiBase: url, } + client.loadAPICredentials() + return &client } @@ -60,3 +62,15 @@ func (client *Client) away(startDate, endDate string) (cal Calendar, err error) return } + +func (client *Client) loadAPICredentials() { + client.apiKey = wtf.Config.UString( + "wtf.mods.bamboohr.apiKey", + os.Getenv("WTF_BAMBOO_HR_TOKEN"), + ) + + client.subdomain = wtf.Config.UString( + "wtf.mods.bamboohr.subdomain", + os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN"), + ) +} diff --git a/circleci/client.go b/circleci/client.go index 16d7eb82..8a796722 100644 --- a/circleci/client.go +++ b/circleci/client.go @@ -9,6 +9,8 @@ import ( "net/http" "net/url" "os" + + "github.com/senorprogrammer/wtf/wtf" ) const APIEnvKey = "WTF_CIRCLE_API_KEY" @@ -59,7 +61,10 @@ func circleRequest(path string) (*http.Response, error) { } func apiKey() string { - return os.Getenv(APIEnvKey) + return wtf.Config.UString( + "wtf.mods.circleci.apiKey", + os.Getenv(APIEnvKey), + ) } func parseJson(obj interface{}, text io.Reader) { diff --git a/docs/imgs/modules/gerrit.png b/docs/imgs/modules/gerrit.png index 6084dc1d..8b472e5c 100644 Binary files a/docs/imgs/modules/gerrit.png and b/docs/imgs/modules/gerrit.png differ diff --git a/docs/index.xml b/docs/index.xml index 5a8d124a..5b9a2732 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -19,12 +19,12 @@ https://wtfutil.com/posts/modules/zendesk/ Added in v0.1.0. Displays tickets in the &ldquo;New&rdquo; status - i.e. have not yet been assigned. -Source Code wtf/zendesk/ Required ENV Variables Key: ZENDESK_API Value: Your Zendesk API Token -Key: ZENDESK_DOMAIN Value: Your Zendesk subdomain -Keyboard Commands Key: [return] Action: Open the selected ticket in the browser. +Source Code wtf/zendesk/ Keyboard Commands Key: [return] Action: Open the selected ticket in the browser. Key: j Action: Select the next item in the list. Key: k Action: Select the previous item in the list. -Key: ↓ Action: Scroll down the list. +Key: ↓ Action: Scroll down the list. +Key: ↑ Action: Scroll up the list. +Configuration zendesk:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:0left:2height:1width:1status:&#34;new&#34;subdomain:&#34;your_domain&#34;username:&#34;your_email@acme.com&#34; Attributes apiKey Value: Your Zendesk API token. @@ -35,10 +35,10 @@ Key: ↓ Action: Scroll down the list. https://wtfutil.com/posts/modules/travisci/ Added in v0.0.12. Displays build information for your Travis CI account. -Source Code wtf/travisci/ Required ENV Variables Key: WTF_TRAVIS_API_TOKEN Value: Your Travis CI API access token. -Keyboard Commands None. -Configuration travisci:enabled:trueposition:top:4left:1height:1width:2pro:falserefreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/travisci/ Keyboard Commands None. +Configuration travisci:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:4left:1height:1width:2pro:falserefreshInterval:900 Attributes apiKey Value: Your Travis CI API access token. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: A positive integer, 0. @@ -49,12 +49,13 @@ position Defines where in the grid this module&rsquo;s widget will be displa https://wtfutil.com/posts/modules/todoist/ Added in v0.0.11. Displays all items on specified project. -Source Code wtf/todoist/ Required ENV Variables Key: WTF_TODOIST_TOKEN Value: Your Todoist API Token. You can get your API Token at: todoist.com/prefs/integrations. -Keyboard Commands Key: h Action: Show the previous project. +Source Code wtf/todoist/ Keyboard Commands Key: h Action: Show the previous project. Key: ← Action: Show the previous project. Key: l Action: Show the next project. Key: → Action: Show the next project. -Key: j Action: Select the next item in the list. +Key: j Action: Select the next item in the list. +Key: ↓ Action: Select the next item in the list. +Key: k Action: Select the previous item in the list. @@ -66,11 +67,11 @@ Key: j Action: Select the next item in the list. Displays information about your projects hosted on Gerrit: Open Incoming Reviews All open reviews that are requesting your approval. My Outgoing Reviews All open reviews created by you. -Source Code wtf/gerrit/ Required ENV Variables Key: WTF_GERRIT_PASSWORD Action: Your Gerrit HTTP Password. -Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Source Code wtf/gerrit/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. Key: h Action: Show the previous project. Key: l Action: Show the next project. -Key: ← Action: Show the previous project. +Key: ← Action: Show the previous project. +Key: → Action: Show the next project. @@ -127,10 +128,10 @@ enabled Determines whether or not this module is executed and if its data displa https://wtfutil.com/posts/modules/circleci/ Added in v0.0.7. Displays build information for your CircleCI account. -Source Code wtf/circleci/ Required ENV Variables Key: WTF_CIRCLE_API_KEY Value: Your CircleCI API token. -Keyboard Commands None. -Configuration circleci:enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/circleci/ Keyboard Commands None. +Configuration circleci:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes apiKey Value: Your CircleCI API token. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: A positive integer, 0. @@ -156,9 +157,9 @@ position Where in the grid this module&rsquo;s widget will be displayed.https://wtfutil.com/posts/modules/jenkins/ Added in v0.0.8. Displays jenkins status of given builds in a project or view -Source Code wtf/jenkins/ Required ENV Variables Key: WTF_JENKINS_API_KEY Value: Your Jenkins API key. -Keyboard Commands None. -Configuration jenkins:enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34;verifyServerCertificate:true Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +Source Code wtf/jenkins/ Keyboard Commands None. +Configuration jenkins:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34;verifyServerCertificate:true Attributes apiKey Value: Your Jenkins API key. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. @@ -173,9 +174,11 @@ refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/gitlab/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Key: h Action: Show the previous project. +Key: l Action: Show the next project. +Key: ← Action: Show the previous project. +Key: → Action: Show the next project. @@ -339,12 +342,12 @@ Key: j Action: Select the next item in the list. https://wtfutil.com/posts/modules/jira/ Displays all Jira issues assigned to you for the specified project. -Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. -Keyboard Commands Key: [return] Action: Open the selected issue in the browser. +Source Code wtf/jira/ Keyboard Commands Key: [return] Action: Open the selected issue in the browser. Key: j Action: Select the next item in the list. Key: k Action: Select the previous item in the list. Key: ↓ Action: Select the next item in the list. -Key: ↑ Action: Select the previous item in the list. +Key: ↑ Action: Select the previous item in the list. +Configuration Single Jira Project jira:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp. @@ -354,10 +357,11 @@ Key: ↑ Action: Select the previous item in the list. https://wtfutil.com/posts/modules/trello/ Displays all Trello cards on specified lists. -Source Code wtf/trello/ Required ENV Variables Key: WTF_TRELLO_APP_KEY Value: Your Trello App Key. Key: WTF_TRELLO_ACCESS_TOKEN Value: Your Trello Access Token. You can get your API key at: trello.com/app-key. -Keyboard Commands None. -Configuration Single Trello List trello:board:Mainenabled:truelist:&#34;Todo&#34;position:height:1left:2top:0width:1refreshInterval:3600username:myname Multiple Trello Lists If you want to monitor multiple Trello lists, use the following configuration (note the difference in list): -trello:board:Mainenabled:truelist:[&#34;Todo&#34;,&#34;Done&#34;]position:height:1left:2top:0width:1refreshInterval:3600username:myname Attributes board The name of the Trello board. +Source Code wtf/trello/ Keyboard Commands None. +Configuration Single Trello List trello:accessToken:&#34;7b8b14f8743a408a93276d7155dd9ee2&#34;apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;board:Mainenabled:truelist:&#34;Todo&#34;position:height:1left:2top:0width:1refreshInterval:3600username:myname Multiple Trello Lists If you want to monitor multiple Trello lists, use the following configuration (note the difference in list): +trello:accessToken:&#34;7b8b14f8743a408a93276d7155dd9ee2&#34;apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;board:Mainenabled:truelist:[&#34;Todo&#34;,&#34;Done&#34;]position:height:1left:2top:0width:1refreshInterval:3600username:myname Attributes accessToken Value: Your Trello access token. +apiKey Value: Your Trello API key. +board The name of the Trello board. enabled Determines whether or not this module is executed and if its data displayed onscreen. @@ -382,10 +386,11 @@ Configuration gcal:colors:title:&#34;red&#34;description:&#34;lightb Displays information about your git repositories hosted on GitHub: Open Review Requests All open code review requests assigned to you. Open Pull Requests All open pull requests created by you. -Source Code wtf/github/ GitHub Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token. -GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token. -Key: WTF_GITHUB_BASE_URL Action: Your GitHub Enterprise API URL. -Key: WTF_GITHUB_UPLOAD_URL Action: Your GitHub Enterprise upload URL (often the same as API URL). +Source Code wtf/github/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Key: h Action: Show the previous git repository. +Key: l Action: Show the next git repository. +Key: ← Action: Show the previous git repository. +Key: → Action: Show the next git repository. @@ -438,10 +443,10 @@ filePath The path to the file to be displayed in the widget. https://wtfutil.com/posts/modules/newrelic/ Connects to the New Relic API and displays the last n deploys of the monitored application: deploy ID, deploy time, and who deployed it. -Source Code wtf/newrelic/ Required ENV Variables Key: WTF_NEW_RELIC_API_KEY Value: Your New Relic API token. -Keyboard Commands None. -Configuration newrelic:applicationId:10549735deployCount:6enabled:trueposition:top:4left:3height:1width:2refreshInterval:900 Attributes applicationId The integer ID of the New Relic application you wish to report on. Values: A positive integer, 0..n. -deployCount The number of past deploys to display on screen. +Source Code wtf/newrelic/ Keyboard Commands None. +Configuration newrelic:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;applicationId:10549735deployCount:6enabled:trueposition:top:4left:3height:1width:2refreshInterval:900 Attributes apiKey Value: Your New Relic API token. +applicationId The integer ID of the New Relic application you wish to report on. Values: A positive integer, 0..n. +deployCount The number of past deploys to display on screen. Values: A positive integer, 0. @@ -451,9 +456,9 @@ deployCount The number of past deploys to display on screen. https://wtfutil.com/posts/modules/opsgenie/ Connects to the OpsGenie API and displays all your scheduled rotations and who&rsquo;s currently on call. -Source Code wtf/opsgenie/ Required ENV Variables Key: WTF_OPS_GENIE_API_KEY Value: Your OpsGenie API token. -Keyboard Commands None. -Configuration opsgenie:displayEmpty:falseenabled:trueposition:top:2left:1height:2width:1refreshInterval:21600 Attributes displayEmpty Whether schedules with no assigned person on-call should be displayed. Values: true, false. +Source Code wtf/opsgenie/ Keyboard Commands None. +Configuration opsgenie:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;displayEmpty:falseenabled:trueposition:top:2left:1height:2width:1refreshInterval:21600 Attributes apiKey &lt; br /&gt; Value: Your OpsGenie API token. +displayEmpty Whether schedules with no assigned person on-call should be displayed. Values: true, false. enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false. position Where in the grid this module&rsquo;s widget will be displayed. @@ -475,11 +480,10 @@ Wifi Network The name of the current network Whether or not the network uses enc https://wtfutil.com/posts/modules/bamboohr/ Connects to the BambooHR API and displays who will be Away today. -Source Code wtf/bamboohr/ Required ENV Variables Key: WTF_BAMBOO_HR_TOKEN Value: Your BambooHR API token. -Key: WTF_BAMBOO_HR_SUBDOMAIN Value: Your BambooHR API subdomain name. -Keyboard Commands None. -Configuration bamboohr:enabled:trueposition:top:0left:1height:2width:1refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/bamboohr/ Keyboard Commands None. +Configuration bamboohr:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:0left:1height:2width:1refreshInterval:900subdomain:&#34;testco&#34; Attributes apiKey Value: Your BambooHR API token. +enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: Any positive integer, 0. diff --git a/docs/posts/index.xml b/docs/posts/index.xml index 1f86265b..a77a62f4 100644 --- a/docs/posts/index.xml +++ b/docs/posts/index.xml @@ -19,12 +19,12 @@ https://wtfutil.com/posts/modules/zendesk/ Added in v0.1.0. Displays tickets in the &ldquo;New&rdquo; status - i.e. have not yet been assigned. -Source Code wtf/zendesk/ Required ENV Variables Key: ZENDESK_API Value: Your Zendesk API Token -Key: ZENDESK_DOMAIN Value: Your Zendesk subdomain -Keyboard Commands Key: [return] Action: Open the selected ticket in the browser. +Source Code wtf/zendesk/ Keyboard Commands Key: [return] Action: Open the selected ticket in the browser. Key: j Action: Select the next item in the list. Key: k Action: Select the previous item in the list. -Key: ↓ Action: Scroll down the list. +Key: ↓ Action: Scroll down the list. +Key: ↑ Action: Scroll up the list. +Configuration zendesk:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:0left:2height:1width:1status:&#34;new&#34;subdomain:&#34;your_domain&#34;username:&#34;your_email@acme.com&#34; Attributes apiKey Value: Your Zendesk API token. @@ -35,10 +35,10 @@ Key: ↓ Action: Scroll down the list. https://wtfutil.com/posts/modules/travisci/ Added in v0.0.12. Displays build information for your Travis CI account. -Source Code wtf/travisci/ Required ENV Variables Key: WTF_TRAVIS_API_TOKEN Value: Your Travis CI API access token. -Keyboard Commands None. -Configuration travisci:enabled:trueposition:top:4left:1height:1width:2pro:falserefreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/travisci/ Keyboard Commands None. +Configuration travisci:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:4left:1height:1width:2pro:falserefreshInterval:900 Attributes apiKey Value: Your Travis CI API access token. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: A positive integer, 0. @@ -49,12 +49,13 @@ position Defines where in the grid this module&rsquo;s widget will be displa https://wtfutil.com/posts/modules/todoist/ Added in v0.0.11. Displays all items on specified project. -Source Code wtf/todoist/ Required ENV Variables Key: WTF_TODOIST_TOKEN Value: Your Todoist API Token. You can get your API Token at: todoist.com/prefs/integrations. -Keyboard Commands Key: h Action: Show the previous project. +Source Code wtf/todoist/ Keyboard Commands Key: h Action: Show the previous project. Key: ← Action: Show the previous project. Key: l Action: Show the next project. Key: → Action: Show the next project. -Key: j Action: Select the next item in the list. +Key: j Action: Select the next item in the list. +Key: ↓ Action: Select the next item in the list. +Key: k Action: Select the previous item in the list. @@ -66,11 +67,11 @@ Key: j Action: Select the next item in the list. Displays information about your projects hosted on Gerrit: Open Incoming Reviews All open reviews that are requesting your approval. My Outgoing Reviews All open reviews created by you. -Source Code wtf/gerrit/ Required ENV Variables Key: WTF_GERRIT_PASSWORD Action: Your Gerrit HTTP Password. -Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Source Code wtf/gerrit/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. Key: h Action: Show the previous project. Key: l Action: Show the next project. -Key: ← Action: Show the previous project. +Key: ← Action: Show the previous project. +Key: → Action: Show the next project. @@ -127,10 +128,10 @@ enabled Determines whether or not this module is executed and if its data displa https://wtfutil.com/posts/modules/circleci/ Added in v0.0.7. Displays build information for your CircleCI account. -Source Code wtf/circleci/ Required ENV Variables Key: WTF_CIRCLE_API_KEY Value: Your CircleCI API token. -Keyboard Commands None. -Configuration circleci:enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/circleci/ Keyboard Commands None. +Configuration circleci:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:4left:1height:1width:2refreshInterval:900 Attributes apiKey Value: Your CircleCI API token. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: A positive integer, 0. @@ -156,9 +157,9 @@ position Where in the grid this module&rsquo;s widget will be displayed.https://wtfutil.com/posts/modules/jenkins/ Added in v0.0.8. Displays jenkins status of given builds in a project or view -Source Code wtf/jenkins/ Required ENV Variables Key: WTF_JENKINS_API_KEY Value: Your Jenkins API key. -Keyboard Commands None. -Configuration jenkins:enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34;verifyServerCertificate:true Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. +Source Code wtf/jenkins/ Keyboard Commands None. +Configuration jenkins:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:2left:3height:2width:3refreshInterval:300url:&#34;https://jenkins.domain.com/jenkins/view_url&#34;user:&#34;username&#34;verifyServerCertificate:true Attributes apiKey Value: Your Jenkins API key. +enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. @@ -173,9 +174,11 @@ refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/gitlab/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Key: h Action: Show the previous project. +Key: l Action: Show the next project. +Key: ← Action: Show the previous project. +Key: → Action: Show the next project. @@ -339,12 +342,12 @@ Key: j Action: Select the next item in the list. https://wtfutil.com/posts/modules/jira/ Displays all Jira issues assigned to you for the specified project. -Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. -Keyboard Commands Key: [return] Action: Open the selected issue in the browser. +Source Code wtf/jira/ Keyboard Commands Key: [return] Action: Open the selected issue in the browser. Key: j Action: Select the next item in the list. Key: k Action: Select the previous item in the list. Key: ↓ Action: Select the next item in the list. -Key: ↑ Action: Select the previous item in the list. +Key: ↑ Action: Select the previous item in the list. +Configuration Single Jira Project jira:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;colors:rows:even:&#34;lightblue&#34;odd:&#34;white&#34;domain:&#34;https://umbrellacorp. @@ -354,10 +357,11 @@ Key: ↑ Action: Select the previous item in the list. https://wtfutil.com/posts/modules/trello/ Displays all Trello cards on specified lists. -Source Code wtf/trello/ Required ENV Variables Key: WTF_TRELLO_APP_KEY Value: Your Trello App Key. Key: WTF_TRELLO_ACCESS_TOKEN Value: Your Trello Access Token. You can get your API key at: trello.com/app-key. -Keyboard Commands None. -Configuration Single Trello List trello:board:Mainenabled:truelist:&#34;Todo&#34;position:height:1left:2top:0width:1refreshInterval:3600username:myname Multiple Trello Lists If you want to monitor multiple Trello lists, use the following configuration (note the difference in list): -trello:board:Mainenabled:truelist:[&#34;Todo&#34;,&#34;Done&#34;]position:height:1left:2top:0width:1refreshInterval:3600username:myname Attributes board The name of the Trello board. +Source Code wtf/trello/ Keyboard Commands None. +Configuration Single Trello List trello:accessToken:&#34;7b8b14f8743a408a93276d7155dd9ee2&#34;apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;board:Mainenabled:truelist:&#34;Todo&#34;position:height:1left:2top:0width:1refreshInterval:3600username:myname Multiple Trello Lists If you want to monitor multiple Trello lists, use the following configuration (note the difference in list): +trello:accessToken:&#34;7b8b14f8743a408a93276d7155dd9ee2&#34;apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;board:Mainenabled:truelist:[&#34;Todo&#34;,&#34;Done&#34;]position:height:1left:2top:0width:1refreshInterval:3600username:myname Attributes accessToken Value: Your Trello access token. +apiKey Value: Your Trello API key. +board The name of the Trello board. enabled Determines whether or not this module is executed and if its data displayed onscreen. @@ -382,10 +386,11 @@ Configuration gcal:colors:title:&#34;red&#34;description:&#34;lightb Displays information about your git repositories hosted on GitHub: Open Review Requests All open code review requests assigned to you. Open Pull Requests All open pull requests created by you. -Source Code wtf/github/ GitHub Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token. -GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token. -Key: WTF_GITHUB_BASE_URL Action: Your GitHub Enterprise API URL. -Key: WTF_GITHUB_UPLOAD_URL Action: Your GitHub Enterprise upload URL (often the same as API URL). +Source Code wtf/github/ Keyboard Commands Key: / Action: Open/close the widget&rsquo;s help window. +Key: h Action: Show the previous git repository. +Key: l Action: Show the next git repository. +Key: ← Action: Show the previous git repository. +Key: → Action: Show the next git repository. @@ -438,10 +443,10 @@ filePath The path to the file to be displayed in the widget. https://wtfutil.com/posts/modules/newrelic/ Connects to the New Relic API and displays the last n deploys of the monitored application: deploy ID, deploy time, and who deployed it. -Source Code wtf/newrelic/ Required ENV Variables Key: WTF_NEW_RELIC_API_KEY Value: Your New Relic API token. -Keyboard Commands None. -Configuration newrelic:applicationId:10549735deployCount:6enabled:trueposition:top:4left:3height:1width:2refreshInterval:900 Attributes applicationId The integer ID of the New Relic application you wish to report on. Values: A positive integer, 0..n. -deployCount The number of past deploys to display on screen. +Source Code wtf/newrelic/ Keyboard Commands None. +Configuration newrelic:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;applicationId:10549735deployCount:6enabled:trueposition:top:4left:3height:1width:2refreshInterval:900 Attributes apiKey Value: Your New Relic API token. +applicationId The integer ID of the New Relic application you wish to report on. Values: A positive integer, 0..n. +deployCount The number of past deploys to display on screen. Values: A positive integer, 0. @@ -451,9 +456,9 @@ deployCount The number of past deploys to display on screen. https://wtfutil.com/posts/modules/opsgenie/ Connects to the OpsGenie API and displays all your scheduled rotations and who&rsquo;s currently on call. -Source Code wtf/opsgenie/ Required ENV Variables Key: WTF_OPS_GENIE_API_KEY Value: Your OpsGenie API token. -Keyboard Commands None. -Configuration opsgenie:displayEmpty:falseenabled:trueposition:top:2left:1height:2width:1refreshInterval:21600 Attributes displayEmpty Whether schedules with no assigned person on-call should be displayed. Values: true, false. +Source Code wtf/opsgenie/ Keyboard Commands None. +Configuration opsgenie:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;displayEmpty:falseenabled:trueposition:top:2left:1height:2width:1refreshInterval:21600 Attributes apiKey &lt; br /&gt; Value: Your OpsGenie API token. +displayEmpty Whether schedules with no assigned person on-call should be displayed. Values: true, false. enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false. position Where in the grid this module&rsquo;s widget will be displayed. @@ -475,11 +480,10 @@ Wifi Network The name of the current network Whether or not the network uses enc https://wtfutil.com/posts/modules/bamboohr/ Connects to the BambooHR API and displays who will be Away today. -Source Code wtf/bamboohr/ Required ENV Variables Key: WTF_BAMBOO_HR_TOKEN Value: Your BambooHR API token. -Key: WTF_BAMBOO_HR_SUBDOMAIN Value: Your BambooHR API subdomain name. -Keyboard Commands None. -Configuration bamboohr:enabled:trueposition:top:0left:1height:2width:1refreshInterval:900 Attributes enabled Determines whether or not this module is executed and if its data displayed onscreen. Values: true, false. -position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. +Source Code wtf/bamboohr/ Keyboard Commands None. +Configuration bamboohr:apiKey:&#34;3276d7155dd9ee27b8b14f8743a408a9&#34;enabled:trueposition:top:0left:1height:2width:1refreshInterval:900subdomain:&#34;testco&#34; Attributes apiKey Value: Your BambooHR API token. +enabled Whether or not this module is executed and if its data displayed onscreen. Values: true, false. +position Defines where in the grid this module&rsquo;s widget will be displayed. refreshInterval How often, in seconds, this module will update its data. Values: Any positive integer, 0. diff --git a/docs/posts/modules/bamboohr/index.html b/docs/posts/modules/bamboohr/index.html index f3b3a664..efe6ef24 100644 --- a/docs/posts/modules/bamboohr/index.html +++ b/docs/posts/modules/bamboohr/index.html @@ -141,31 +141,28 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/bamboohr/
-

Required ENV Variables

- -

Key: WTF_BAMBOO_HR_TOKEN
-Value: Your BambooHR API token.

- -

Key: WTF_BAMBOO_HR_SUBDOMAIN
-Value: Your BambooHR API subdomain name.

-

Keyboard Commands

None.

Configuration

bamboohr:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 0
     left: 1
     height: 2
     width: 1
-  refreshInterval: 900
+ refreshInterval: 900 + subdomain: "testco"

Attributes

+

apiKey
+Value: Your BambooHR API token.

+

enabled
-Determines whether or not this module is executed and if its data displayed onscreen.
+Whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

position
@@ -175,6 +172,9 @@ Defines where in the grid this module’s widget will be displayed.
Values: Any positive integer, 0..n.

+

subdomain
+Value: Your BambooHR API subdomain name.

+

Attributes

@@ -208,8 +204,11 @@ Values: A valid URI.

projects
A list of Gerrit project names to fetch data for.

+

password
+Value: Your Gerrit HTTP Password.

+

username
-Your Gerrit username.

+Your Gerrit username.

verifyServerCertificate
Optional
diff --git a/docs/posts/modules/github/index.html b/docs/posts/modules/github/index.html index bce066f9..d258bf03 100644 --- a/docs/posts/modules/github/index.html +++ b/docs/posts/modules/github/index.html @@ -151,22 +151,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/github/
-

GitHub Required ENV Variables

- -

Key: WTF_GITHUB_TOKEN
-Action: Your GitHub API token.

- -

GitHub Enterprise Required ENV Variables

- -

Key: WTF_GITHUB_TOKEN
-Action: Your GitHub API token.

- -

Key: WTF_GITHUB_BASE_URL
-Action: Your GitHub Enterprise API URL.

- -

Key: WTF_GITHUB_UPLOAD_URL
-Action: Your GitHub Enterprise upload URL (often the same as API URL).

-

Keyboard Commands

Key: /
@@ -186,6 +170,8 @@ height="0" width="0" style="display:none;visibility:hidden">

Configuration

github:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
+  baseURL: ""
   enabled: true
   enableStatus: true
   position:
@@ -197,11 +183,19 @@ height="0" width="0" style="display:none;visibility:hidden">
   repositories:
     wesker-api: "UmbrellaCorp"
     wtf: "senorprogrammer"
+  uploadURL: ""
   username: "senorprogrammer"

Attributes

+

apiKey
+Value: Your GitHub API token.

+ +

baseURL
+Optional
+Value: Your GitHub Enterprise API URL.

+

enabled
-Determines whether or not this module is executed and if its data displayed onscreen.
+Whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

enableStatus
@@ -222,6 +216,10 @@ for.
Key: The name of the repository.
Value: The name of the account or organization that owns the repository.

+

uploadURL
+Optional
+Value: Your GitHub Enterprise upload URL (often the same as API URL).

+

username
Your GitHub username. Used to figure out which review requests you’ve been added to.

diff --git a/docs/posts/modules/gitlab/index.html b/docs/posts/modules/gitlab/index.html index 67546e1e..21246d6d 100644 --- a/docs/posts/modules/gitlab/index.html +++ b/docs/posts/modules/gitlab/index.html @@ -153,11 +153,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/gitlab/
-

Required ENV Variables

- -

Key: WTF_GITLAB_TOKEN
-Action: A GitLab personal access token. Requires at least api access.

-

Keyboard Commands

Key: /
@@ -177,6 +172,7 @@ height="0" width="0" style="display:none;visibility:hidden">

Configuration

gitlab:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 2
@@ -190,6 +186,9 @@ height="0" width="0" style="display:none;visibility:hidden">
   username: "senorprogrammer"

Attributes

+

apiKey
+Value: A GitLab personal access token. Requires at least api access.

+

enabled
Determines whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

diff --git a/docs/posts/modules/jenkins/index.html b/docs/posts/modules/jenkins/index.html index d38f9d8b..73b7009d 100644 --- a/docs/posts/modules/jenkins/index.html +++ b/docs/posts/modules/jenkins/index.html @@ -146,17 +146,13 @@ width="320" height="68" alt="jenkins screenshot" />

Source Code

wtf/jenkins/
-

Required ENV Variables

- -

Key: WTF_JENKINS_API_KEY
-Value: Your Jenkins API key.

-

Keyboard Commands

None.

Configuration

jenkins:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 2
@@ -169,6 +165,9 @@ width="320" height="68" alt="jenkins screenshot" />

verifyServerCertificate: true

Attributes

+

apiKey
+Value: Your Jenkins API key.

+

enabled
Determines whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

diff --git a/docs/posts/modules/jira/index.html b/docs/posts/modules/jira/index.html index 12edf37f..40babe3d 100644 --- a/docs/posts/modules/jira/index.html +++ b/docs/posts/modules/jira/index.html @@ -143,11 +143,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/jira/
-

Required ENV Variables

- -

Key: WTF_JIRA_API_KEY
-Value: Your Jira API key.

-

Keyboard Commands

Key: [return]
@@ -169,6 +164,7 @@ height="0" width="0" style="display:none;visibility:hidden">

Single Jira Project

jira:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   colors:
     rows:
       even: "lightblue"
@@ -191,6 +187,7 @@ height="0" width="0" style="display:none;visibility:hidden">
 

If you want to monitor multiple Jira projects, use the following configuration (note the difference in project):

jira:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   colors:
     rows:
       even: "lightblue"
@@ -210,6 +207,9 @@ configuration (note the difference in project):

verifyServerCertificate: true

Attributes

+

apiKey
+Value: Your Jira API key.

+

colors.rows.even
Define the foreground color for even-numbered rows.
Values: Any X11 diff --git a/docs/posts/modules/newrelic/index.html b/docs/posts/modules/newrelic/index.html index a5f87d7f..59969c82 100644 --- a/docs/posts/modules/newrelic/index.html +++ b/docs/posts/modules/newrelic/index.html @@ -144,18 +144,13 @@ monitored application: deploy ID, deploy time, and who deployed it.

Source Code

wtf/newrelic/
-

Required ENV Variables

- -

Key: WTF_NEW_RELIC_API_KEY
-Value: Your
New Relic API -token.

-

Keyboard Commands

None.

Configuration

newrelic:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   applicationId: 10549735
   deployCount: 6
   enabled: true
@@ -167,6 +162,9 @@ token.

refreshInterval: 900

Attributes

+

apiKey
+Value: Your New Relic API token.

+

applicationId
The integer ID of the New Relic application you wish to report on.
diff --git a/docs/posts/modules/opsgenie/index.html b/docs/posts/modules/opsgenie/index.html index d8bb1f62..df8ec6d9 100644 --- a/docs/posts/modules/opsgenie/index.html +++ b/docs/posts/modules/opsgenie/index.html @@ -144,18 +144,13 @@ and who’s currently on call.

Source Code

wtf/opsgenie/
-

Required ENV Variables

- -

Key: WTF_OPS_GENIE_API_KEY
-Value: Your OpsGenie -API token.

-

Keyboard Commands

None.

Configuration

opsgenie:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   displayEmpty: false
   enabled: true
   position:
@@ -166,6 +161,9 @@ API token.

refreshInterval: 21600

Attributes

+

apiKey < br /> +Value: Your OpsGenie API token.

+

displayEmpty
Whether schedules with no assigned person on-call should be displayed.
Values: true, false.

diff --git a/docs/posts/modules/todoist/index.html b/docs/posts/modules/todoist/index.html index a2e6e8a1..9fd8ed2e 100644 --- a/docs/posts/modules/todoist/index.html +++ b/docs/posts/modules/todoist/index.html @@ -145,13 +145,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/todoist/
-

Required ENV Variables

- -

Key: WTF_TODOIST_TOKEN
-Value: Your Todoist API Token.

- -

You can get your API Token at: todoist.com/prefs/integrations.

-

Keyboard Commands

Key: h
@@ -189,6 +182,7 @@ height="0" width="0" style="display:none;visibility:hidden">

Configuration

todoist:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 0
@@ -200,6 +194,9 @@ height="0" width="0" style="display:none;visibility:hidden">
   refreshInterval: 3600

Attributes

+

apiKey
+Value: Your Todoist API token.

+

enabled
Determines whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

diff --git a/docs/posts/modules/travisci/index.html b/docs/posts/modules/travisci/index.html index cf28640f..80fb84ba 100644 --- a/docs/posts/modules/travisci/index.html +++ b/docs/posts/modules/travisci/index.html @@ -145,17 +145,13 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/travisci/
-

Required ENV Variables

- -

Key: WTF_TRAVIS_API_TOKEN
-Value: Your Travis CI API access token.

-

Keyboard Commands

None.

Configuration

travisci:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 4
@@ -166,6 +162,9 @@ height="0" width="0" style="display:none;visibility:hidden">
   refreshInterval: 900

Attributes

+

apiKey
+Value: Your Travis CI API access token.

+

enabled
Determines whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

diff --git a/docs/posts/modules/trello/index.html b/docs/posts/modules/trello/index.html index ff6efcb0..7be6552e 100644 --- a/docs/posts/modules/trello/index.html +++ b/docs/posts/modules/trello/index.html @@ -143,15 +143,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/trello/
-

Required ENV Variables

- -

Key: WTF_TRELLO_APP_KEY
-Value: Your Trello App Key.
-Key: WTF_TRELLO_ACCESS_TOKEN
-Value: Your Trello Access Token.

- -

You can get your API key at: trello.com/app-key.

-

Keyboard Commands

None.

@@ -159,11 +150,13 @@ height="0" width="0" style="display:none;visibility:hidden">

Configuration

Single Trello List

-
trello: 
+
trello:
+  accessToken: "7b8b14f8743a408a93276d7155dd9ee2"
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   board: Main
   enabled: true
   list: "Todo"
-  position: 
+  position:
     height: 1
     left: 2
     top: 0
@@ -174,11 +167,13 @@ height="0" width="0" style="display:none;visibility:hidden">
 
 

If you want to monitor multiple Trello lists, use the following configuration (note the difference in list):

-
trello: 
+
trello:
+  accessToken: "7b8b14f8743a408a93276d7155dd9ee2"
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   board: Main
   enabled: true
   list: ["Todo", "Done"]
-  position: 
+  position:
     height: 1
     left: 2
     top: 0
@@ -187,6 +182,12 @@ configuration (note the difference in list):

username: myname

Attributes

+

accessToken
+Value: Your Trello access token.

+ +

apiKey
+Value: Your Trello API key.

+

board
The name of the Trello board.

diff --git a/docs/posts/modules/zendesk/index.html b/docs/posts/modules/zendesk/index.html index 0afa4c1b..0ef1b309 100644 --- a/docs/posts/modules/zendesk/index.html +++ b/docs/posts/modules/zendesk/index.html @@ -143,14 +143,6 @@ height="0" width="0" style="display:none;visibility:hidden">

Source Code

wtf/zendesk/
-

Required ENV Variables

- -

Key: ZENDESK_API
-Value: Your Zendesk API Token

- -

Key: ZENDESK_DOMAIN
-Value: Your Zendesk subdomain

-

Keyboard Commands

Key: [return]
@@ -170,6 +162,7 @@ height="0" width="0" style="display:none;visibility:hidden">

Configuration

zendesk:
+  apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
   enabled: true
   position:
     top: 0
@@ -177,9 +170,13 @@ height="0" width="0" style="display:none;visibility:hidden">
     height: 1
     width: 1
   status: "new"
+  subdomain: "your_domain"
   username: "your_email@acme.com"

Attributes

+

apiKey
+Value: Your Zendesk API token.

+

enabled
Determines whether or not this module is executed and if its data displayed onscreen.
Values: true, false.

@@ -191,6 +188,9 @@ Defines where in the grid this module’s widget will be displayed.
new
, open, pending, hold.

+

subdomain
+Value: Your Zendesk subdomain.

+

username
Your Zendesk username Values: A valid Zendesk username (usually an email address).

diff --git a/gerrit/widget.go b/gerrit/widget.go index 0f3f2095..bd87fef2 100644 --- a/gerrit/widget.go +++ b/gerrit/widget.go @@ -3,13 +3,14 @@ package gerrit import ( "crypto/tls" "fmt" + "net/http" + "os" + "regexp" + glb "github.com/andygrunwald/go-gerrit" "github.com/gdamore/tcell" "github.com/rivo/tview" "github.com/senorprogrammer/wtf/wtf" - "net/http" - "os" - "regexp" ) const HelpText = ` @@ -43,7 +44,12 @@ var ( func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { baseURL := wtf.Config.UString("wtf.mods.gerrit.domain") username := wtf.Config.UString("wtf.mods.gerrit.username") - password := os.Getenv("WTF_GERRIT_PASSWORD") + + password := wtf.Config.UString( + "wtf.mods.gerrit.password", + os.Getenv("WTF_GERRIT_PASSWORD"), + ) + verifyServerCertificate := wtf.Config.UBool("wtf.mods.gerrit.verifyServerCertificate", true) httpClient := &http.Client{Transport: &http.Transport{ diff --git a/github/github_repo.go b/github/github_repo.go index 80640f5a..7bf210f7 100644 --- a/github/github_repo.go +++ b/github/github_repo.go @@ -6,6 +6,7 @@ import ( "os" ghb "github.com/google/go-github/github" + "github.com/senorprogrammer/wtf/wtf" "golang.org/x/oauth2" ) @@ -22,14 +23,12 @@ type GithubRepo struct { func NewGithubRepo(name, owner string) *GithubRepo { repo := GithubRepo{ - apiKey: os.Getenv("WTF_GITHUB_TOKEN"), - baseURL: os.Getenv("WTF_GITHUB_BASE_URL"), - uploadURL: os.Getenv("WTF_GITHUB_UPLOAD_URL"), - Name: name, Owner: owner, } + repo.loadAPICredentials() + return &repo } @@ -91,6 +90,23 @@ func (repo *GithubRepo) githubClient() (*ghb.Client, error) { return ghb.NewClient(oauthClient), nil } +func (repo *GithubRepo) loadAPICredentials() { + repo.apiKey = wtf.Config.UString( + "wtf.mods.github.apiKey", + os.Getenv("WTF_GITHUB_TOKEN"), + ) + + repo.baseURL = wtf.Config.UString( + "wtf.mods.github.baseURL", + os.Getenv("WTF_GITHUB_BASE_URL"), + ) + + repo.uploadURL = wtf.Config.UString( + "wtf.mods.github.uploadURL", + os.Getenv("WTF_GITHUB_UPLOAD_URL"), + ) +} + // myPullRequests returns a list of pull requests created by username on this repo func (repo *GithubRepo) myPullRequests(username string) []*ghb.PullRequest { prs := []*ghb.PullRequest{} diff --git a/gitlab/widget.go b/gitlab/widget.go index 2a9324d5..081abd80 100644 --- a/gitlab/widget.go +++ b/gitlab/widget.go @@ -34,9 +34,14 @@ type Widget struct { } func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { - apiKey := os.Getenv("WTF_GITLAB_TOKEN") + apiKey := wtf.Config.UString( + "wtf.mods.gitlab.apiKey", + os.Getenv("WTF_GITLAB_TOKEN"), + ) + baseURL := wtf.Config.UString("wtf.mods.gitlab.domain") gitlab := glb.NewClient(nil, apiKey) + if baseURL != "" { gitlab.SetBaseURL(baseURL) } diff --git a/jenkins/widget.go b/jenkins/widget.go index 262da966..cf12609f 100644 --- a/jenkins/widget.go +++ b/jenkins/widget.go @@ -28,11 +28,10 @@ func (widget *Widget) Refresh() { view, err := Create( wtf.Config.UString("wtf.mods.jenkins.url"), wtf.Config.UString("wtf.mods.jenkins.user"), - os.Getenv("WTF_JENKINS_API_KEY"), + widget.apiKey(), ) widget.UpdateRefreshedAt() - //widget.View.Clear() var content string if err != nil { @@ -50,6 +49,13 @@ func (widget *Widget) Refresh() { /* -------------------- Unexported Functions -------------------- */ +func (widget *Widget) apiKey() string { + return wtf.Config.UString( + "wtf.mods.jenkins.apiKey", + os.Getenv("WTF_JENKINS_API_KEY"), + ) +} + func (widget *Widget) contentFrom(view *View) string { str := fmt.Sprintf(" [red]%s[white]\n", view.Name) diff --git a/jira/client.go b/jira/client.go index b28ec616..4ff0f5c2 100644 --- a/jira/client.go +++ b/jira/client.go @@ -54,6 +54,13 @@ func buildJql(key string, value string) string { /* -------------------- Unexported Functions -------------------- */ +func apiKey() string { + return wtf.Config.UString( + "wtf.mods.jira.apiKey", + os.Getenv("WTF_JIRA_API_KEY"), + ) +} + func jiraRequest(path string) (*http.Response, error) { url := fmt.Sprintf("%s%s", wtf.Config.UString("wtf.mods.jira.domain"), path) @@ -61,7 +68,7 @@ func jiraRequest(path string) (*http.Response, error) { if err != nil { return nil, err } - req.SetBasicAuth(wtf.Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY")) + req.SetBasicAuth(wtf.Config.UString("wtf.mods.jira.email"), apiKey()) verifyServerCertificate := wtf.Config.UBool("wtf.mods.jira.verifyServerCertificate", true) httpClient := &http.Client{Transport: &http.Transport{ diff --git a/newrelic/client.go b/newrelic/client.go index f88d4e3e..e3937338 100644 --- a/newrelic/client.go +++ b/newrelic/client.go @@ -8,7 +8,7 @@ import ( ) func Application() (*nr.Application, error) { - client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY")) + client := nr.NewClient(apiKey()) application, err := client.GetApplication(wtf.Config.UInt("wtf.mods.newrelic.applicationId")) if err != nil { @@ -19,7 +19,7 @@ func Application() (*nr.Application, error) { } func Deployments() ([]nr.ApplicationDeployment, error) { - client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY")) + client := nr.NewClient(apiKey()) opts := &nr.ApplicationDeploymentOptions{Page: 1} deployments, err := client.GetApplicationDeployments(wtf.Config.UInt("wtf.mods.newrelic.applicationId"), opts) @@ -29,3 +29,10 @@ func Deployments() ([]nr.ApplicationDeployment, error) { return deployments, nil } + +func apiKey() string { + return wtf.Config.UString( + "wtf.mods.newrelic.apiKey", + os.Getenv("WTF_NEW_RELIC_API_KEY"), + ) +} diff --git a/newrelic/widget.go b/newrelic/widget.go index 8c4fd8b7..84bdb6bf 100644 --- a/newrelic/widget.go +++ b/newrelic/widget.go @@ -31,7 +31,7 @@ func (widget *Widget) Refresh() { } widget.UpdateRefreshedAt() - widget.View.SetTitle(fmt.Sprintf("%s- [green]%s[white]", widget.Name, appName)) + widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s - [green]%s[white]", widget.Name, appName))) widget.View.Clear() var content string diff --git a/opsgenie/client.go b/opsgenie/client.go index 59ba2b90..b2a980cf 100644 --- a/opsgenie/client.go +++ b/opsgenie/client.go @@ -5,6 +5,8 @@ import ( "fmt" "net/http" "os" + + "github.com/senorprogrammer/wtf/wtf" ) type OnCallResponse struct { @@ -28,16 +30,22 @@ type Parent struct { /* -------------------- Exported Functions -------------------- */ func Fetch() (*OnCallResponse, error) { - apiKey := os.Getenv("WTF_OPS_GENIE_API_KEY") scheduleUrl := "https://api.opsgenie.com/v2/schedules/on-calls?flat=true" - response, err := opsGenieRequest(scheduleUrl, apiKey) + response, err := opsGenieRequest(scheduleUrl, apiKey()) return response, err } /* -------------------- Unexported Functions -------------------- */ +func apiKey() string { + return wtf.Config.UString( + "wtf.mods.opsgenie.apiKey", + os.Getenv("WTF_OPS_GENIE_API_KEY"), + ) +} + func opsGenieRequest(url string, apiKey string) (*OnCallResponse, error) { req, err := http.NewRequest("GET", url, nil) if err != nil { diff --git a/opsgenie/widget.go b/opsgenie/widget.go index c95b7dcd..aab56db3 100644 --- a/opsgenie/widget.go +++ b/opsgenie/widget.go @@ -25,7 +25,7 @@ func (widget *Widget) Refresh() { data, err := Fetch() widget.UpdateRefreshedAt() - widget.View.SetTitle(widget.Name) + widget.View.SetTitle(widget.ContextualTitle(widget.Name)) var content string if err != nil { diff --git a/todoist/widget.go b/todoist/widget.go index 6ee4f202..c10da595 100644 --- a/todoist/widget.go +++ b/todoist/widget.go @@ -44,7 +44,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { pages: pages, } - todoist.Token = os.Getenv("WTF_TODOIST_TOKEN") + widget.loadAPICredentials() widget.projects = loadProjects() widget.View.SetInputCapture(widget.keyboardIntercept) @@ -170,7 +170,13 @@ func (w *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey { return event } -// TODO: Rename this List to Projects so the internal can be Checklist +func (widget *Widget) loadAPICredentials() { + todoist.Token = wtf.Config.UString( + "wtf.mods.todoist.apiKey", + os.Getenv("WTF_TODOIST_TOKEN"), + ) +} + func loadProjects() []*Project { projects := []*Project{} diff --git a/travisci/client.go b/travisci/client.go index 8e80d0de..1e66cb41 100644 --- a/travisci/client.go +++ b/travisci/client.go @@ -72,7 +72,10 @@ func travisRequest(path string) (*http.Response, error) { } func apiToken() string { - return os.Getenv(APIEnvToken) + return wtf.Config.UString( + "wtf.mods.travisci.apiKey", + os.Getenv(APIEnvToken), + ) } func parseJson(obj interface{}, text io.Reader) { diff --git a/trello/widget.go b/trello/widget.go index 2c2459a4..faa69abd 100644 --- a/trello/widget.go +++ b/trello/widget.go @@ -23,7 +23,10 @@ func NewWidget() *Widget { /* -------------------- Exported Functions -------------------- */ func (widget *Widget) Refresh() { - client := trello.NewClient(os.Getenv("WTF_TRELLO_APP_KEY"), os.Getenv("WTF_TRELLO_ACCESS_TOKEN")) + client := trello.NewClient( + widget.apiKey(), + widget.accessToken(), + ) // Get the cards searchResult, err := GetCards(client, getLists()) @@ -50,6 +53,21 @@ func (widget *Widget) Refresh() { } /* -------------------- Unexported Functions -------------------- */ + +func (widget *Widget) accessToken() string { + return wtf.Config.UString( + "wtf.mods.trello.accessToken", + os.Getenv("WTF_TRELLO_ACCESS_TOKEN"), + ) +} + +func (widget *Widget) apiKey() string { + return wtf.Config.UString( + "wtf.mods.trello.apiKey", + os.Getenv("WTF_TRELLO_APP_KEY"), + ) +} + func (widget *Widget) contentFrom(searchResult *SearchResult) string { str := "" diff --git a/weatherservices/weather/widget.go b/weatherservices/weather/widget.go index 48062285..2d7448e3 100644 --- a/weatherservices/weather/widget.go +++ b/weatherservices/weather/widget.go @@ -1,13 +1,11 @@ package weather import ( - "fmt" "os" owm "github.com/briandowns/openweathermap" "github.com/gdamore/tcell" "github.com/rivo/tview" - "github.com/senorprogrammer/wtf/logger" "github.com/senorprogrammer/wtf/wtf" ) @@ -43,14 +41,10 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { app: app, pages: pages, - APIKey: os.Getenv("WTF_OWM_API_KEY"), - Idx: 0, + Idx: 0, } - if widget.APIKey == "" { - logger.Log("loading weather API key from config") - widget.APIKey = wtf.Config.UString(fmt.Sprintf("wtf.mods.%s.apiKey", configKey), "") - } + widget.loadAPICredentials() widget.View.SetInputCapture(widget.keyboardIntercept) @@ -188,6 +182,15 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey { } } +// loadAPICredentials loads the API authentication credentials for this module +// First checks to see if they're in the config file. If not, checks the ENV var +func (widget *Widget) loadAPICredentials() { + widget.APIKey = wtf.Config.UString( + "wtf.mods.weather.apiKey", + os.Getenv("WTF_OWM_API_KEY"), + ) +} + func (widget *Widget) showHelp() { closeFunc := func() { widget.pages.RemovePage("help") diff --git a/wtftests/bargraph/bargraph_test.go b/wtf_tests/bargraph/bargraph_test.go similarity index 96% rename from wtftests/bargraph/bargraph_test.go rename to wtf_tests/bargraph/bargraph_test.go index 41c2ef7b..02a383e9 100644 --- a/wtftests/bargraph/bargraph_test.go +++ b/wtf_tests/bargraph/bargraph_test.go @@ -1,4 +1,4 @@ -package bargraphtests +package bargraph_test import ( "testing" diff --git a/wtf_tests/colors_test.go b/wtf_tests/colors_test.go new file mode 100644 index 00000000..8c2e6f77 --- /dev/null +++ b/wtf_tests/colors_test.go @@ -0,0 +1,14 @@ +package wtf_tests + +import ( + "testing" + + . "github.com/senorprogrammer/wtf/wtf" + . "github.com/stretchr/testify/assert" +) + +func TestASCIItoTviewColors(t *testing.T) { + Equal(t, "", ASCIItoTviewColors("")) + Equal(t, "cat", ASCIItoTviewColors("cat")) + Equal(t, "[38;5;226mcat/[-]", ASCIItoTviewColors("[38;5;226mcat/")) +} diff --git a/wtftests/datetime_test.go b/wtf_tests/datetime_test.go similarity index 96% rename from wtftests/datetime_test.go rename to wtf_tests/datetime_test.go index a9159d07..8415d345 100644 --- a/wtftests/datetime_test.go +++ b/wtf_tests/datetime_test.go @@ -1,4 +1,4 @@ -package wtftests +package wtf_tests import ( "testing" diff --git a/wtftests/position_test.go b/wtf_tests/position_test.go similarity index 96% rename from wtftests/position_test.go rename to wtf_tests/position_test.go index 336bc964..370a3373 100644 --- a/wtftests/position_test.go +++ b/wtf_tests/position_test.go @@ -1,4 +1,4 @@ -package wtftests +package wtf_tests import ( "testing" diff --git a/wtftests/utils_test.go b/wtf_tests/utils_test.go similarity index 99% rename from wtftests/utils_test.go rename to wtf_tests/utils_test.go index b1aa7994..d78425cc 100644 --- a/wtftests/utils_test.go +++ b/wtf_tests/utils_test.go @@ -1,4 +1,4 @@ -package wtftests +package wtf_tests import ( "testing" diff --git a/zendesk/client.go b/zendesk/client.go index e450fb7b..19b7b54b 100644 --- a/zendesk/client.go +++ b/zendesk/client.go @@ -16,9 +16,19 @@ type Resource struct { Raw string } -var a = os.Getenv("ZENDESK_API") -var subdomain = os.Getenv("ZENDESK_SUBDOMAIN") -var baseURL = fmt.Sprintf("https://%v.zendesk.com/api/v2", subdomain) +func apiKey() string { + return wtf.Config.UString( + "wtf.mods.zendesk.apiKey", + os.Getenv("ZENDESK_API"), + ) +} + +func subdomain() string { + return wtf.Config.UString( + "wtf.mods.zendesk.apiKey", + os.Getenv("ZENDESK_API"), + ) +} func errHandler(err error) { if err != nil { @@ -26,20 +36,15 @@ func errHandler(err error) { } } -func buildUrl(baseURL string) string { - ticketURL := baseURL + "/tickets.json?sort_by=status" - return ticketURL -} - func api(key string, meth string, path string, params string) (*Resource, error) { - trn := &http.Transport{} client := &http.Client{ Transport: trn, } - var URL = buildUrl(baseURL) + baseURL := fmt.Sprintf("https://%v.zendesk.com/api/v2", subdomain()) + URL := baseURL + "/tickets.json?sort_by=status" req, err := http.NewRequest(meth, URL, bytes.NewBufferString(params)) if err != nil { diff --git a/zendesk/tickets.go b/zendesk/tickets.go index 8cbe53d2..a5ba7575 100644 --- a/zendesk/tickets.go +++ b/zendesk/tickets.go @@ -55,7 +55,7 @@ func listTickets(pag ...string) (*TicketArray, error) { } else { path = pag[0] } - resource, err := api(a, "GET", path, "") + resource, err := api(apiKey(), "GET", path, "") if err != nil { return nil, err } diff --git a/zendesk/widget.go b/zendesk/widget.go index c2b57ab6..cdf5825e 100644 --- a/zendesk/widget.go +++ b/zendesk/widget.go @@ -103,7 +103,7 @@ func (widget *Widget) openTicket() { sel := widget.selected if sel >= 0 && widget.result != nil && sel < len(widget.result.Tickets) { issue := &widget.result.Tickets[widget.selected] - ticketUrl := fmt.Sprintf("https://%s.zendesk.com/agent/tickets/%d", subdomain, issue.Id) + ticketUrl := fmt.Sprintf("https://%s.zendesk.com/agent/tickets/%d", subdomain(), issue.Id) wtf.OpenFile(ticketUrl) } }