Skip to content

Commit 89451a0

Browse files
committed
Add badgedata support
1 parent 7412d34 commit 89451a0

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

.gcloudignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore

README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,9 @@ This is the source that runs [https://code.golift.io](https://code.golift.io).
1919
- Path redirects. Issue 302s for specific paths.
2020
- Useful for redirecting to download links on GitHub.
2121

22-
#### TODO
23-
Incorporate a badge package for data collection and return.
24-
In other words, I want to make this app collect data from "things"
22+
#### Other
23+
Incorporated a badge package for data collection and return.
24+
In other words this app can collect data from "things"
2525
(like the public grafana api) and store that data for later requests.
26-
I will use this to populate badge/shield data for things like "grafana
27-
dashboard download counter"
28-
```json
29-
{
30-
"subject": "leftSide",
31-
"status": "rightSide",
32-
"color": "blue"
33-
}
34-
```
35-
```
36-
/https/code.golift.io/badge/grafana/dashboard/downloads/id+id+id+id
37-
```
26+
I use this to populate badge/shield data for things like "grafana
27+
dashboard download counter" - [https://github.com/golift/badgedata](https://github.com/golift/badgedata)

appengine.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"log"
2222
"net/http"
2323

24+
"code.golift.io/badgedata"
25+
_ "code.golift.io/badgedata/grafana"
2426
"google.golang.org/appengine"
2527
)
2628

@@ -34,6 +36,7 @@ func main() {
3436
log.Fatal(err)
3537
}
3638
http.Handle("/", h)
39+
http.Handle("/bd/", badgedata.Handler())
3740
appengine.Main()
3841
}
3942

config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ redir_paths: ["tar.gz", "wiki", "releases"]
3030

3131
# Paths that get handled by this app.
3232
paths:
33-
/badge:
34-
repo: https://github.com/golift/badge
35-
redir: https://github.com/golift/badge
33+
/badgedata:
34+
repo: https://github.com/golift/badgedata
35+
redir: https://github.com/golift/badgedata
3636
/unifi:
3737
repo: https://github.com/golift/unifi
3838
redir: https://github.com/golift/unifi

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import (
2121
"log"
2222
"net/http"
2323
"os"
24+
25+
"code.golift.io/badgedata"
26+
_ "code.golift.io/badgedata/grafana"
2427
)
2528

2629
func main() {
@@ -41,6 +44,7 @@ func main() {
4144
if err != nil {
4245
log.Fatal(err)
4346
}
47+
http.Handle("/bd/", badgedata.Handler())
4448
http.Handle("/", h)
4549
log.Println("Listening at http://127.0.0.1:8080")
4650
if err := http.ListenAndServe(":8080", nil); err != nil {

0 commit comments

Comments
 (0)