1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Now expects the Google Calendar client_secret.yml to be in ~/.wtf/gcal/client_secret.yml

This commit is contained in:
Chris Cummer 2018-04-04 15:35:29 -07:00 committed by Chris Cummer
parent d41f5f5f99
commit dd51994d8d
2 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,9 @@ wtf:
refreshInterval: 900
url: "https://api.bamboohr.com/api/gateway.php"
gcal:
eventCount: 10
refreshInterval: 300
secretFile: "~/.wtf/gcal/client_secret.json"
git:
refreshInterval: 8
jira:

View File

@ -17,6 +17,7 @@ import (
"path/filepath"
"time"
"github.com/senorprogrammer/wtf/homedir"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
@ -28,7 +29,9 @@ import (
func Fetch() (*calendar.Events, error) {
ctx := context.Background()
b, err := ioutil.ReadFile("./gcal/client_secret.json")
secretPath, _ := homedir.Expand(Config.UString("wtf.gcal.secretFile"))
b, err := ioutil.ReadFile(secretPath)
if err != nil {
return nil, err
}
@ -45,7 +48,7 @@ func Fetch() (*calendar.Events, error) {
}
t := today().Format(time.RFC3339)
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy("startTime").Do()
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(int64(Config.UInt("wtf.gcal.eventCount", 10))).OrderBy("startTime").Do()
if err != nil {
return nil, err
}