Skip to content

Commit a53dbd9

Browse files
committed
misc: examples adjusted
1 parent 7234c1f commit a53dbd9

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

dropbox.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ type DropboxObject struct {
2929
}
3030

3131
type DropboxConfiguration struct {
32-
Debug Bool `json:"debug"`
33-
Token string `json:"token"`
32+
Debug Bool `json:"debug"`
33+
Token string `json:"token"`
34+
ClientId string `json:"client_id"`
35+
ClientSecret string `json:"client_secret"`
3436
}
3537

3638
func newDropboxWatcher(dir string, interval time.Duration) (Watcher, error) {
@@ -65,7 +67,6 @@ func (w *DropboxWatcher) SetConfig(m map[string]string) error {
6567
}
6668
w.config = &config
6769

68-
6970
fmt.Printf("%v", config)
7071
return nil
7172
}
@@ -216,10 +217,6 @@ func (w *DropboxWatcher) enumerateFiles(prefix string, callback func(object *Dro
216217
o.LastModified = f.ServerModified
217218
o.Hash = f.ContentHash
218219
callback(o)
219-
//case *files.FolderMetadata:
220-
// o.Key = f.PathDisplay
221-
// o.Size = 0
222-
// o.LastModified = 0
223220
}
224221
}
225222

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import (
99
"time"
1010
)
1111

12+
const (
13+
ClientId = "ZZZZZZ"
14+
ClientSecret = "YYYYYY"
15+
Token = "XXXXXX"
16+
)
17+
1218
func getAuthCode() (string, error) {
1319
conf := &oauth2.Config{
14-
ClientID: "CLIENT_ID_HERE",
15-
ClientSecret: "CLIENT_SECRET_HERE",
20+
ClientID: ClientId,
21+
ClientSecret: ClientSecret,
1622
Endpoint: dropbox.OAuthEndpoint(""),
1723
}
1824

@@ -41,11 +47,11 @@ func main() {
4147
}
4248

4349
config := map[string]string{
44-
"debug": "true",
45-
"token": "",
50+
"debug": "true",
51+
"token": Token,
4652
}
4753

48-
if v, ok := config["token"]; !ok || v == "" {
54+
if v, ok := config["token"]; !ok || v == "" {
4955
token, err := getAuthCode()
5056
if err != nil {
5157
fmt.Printf("ERROR: %s", err)
File renamed without changes.

0 commit comments

Comments
 (0)