Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1.  
  2. // Error
  3. ./knoxite -r backblaze://49979f5abff9:001ac045eb46758d123dbab9d487aa32fb6e291ff8@backblaze.com/KnoxiteTestRepo -p "123" repo init
  4.  
  5. Creating repository at backblaze://49979f5abff9:001ac045eb46758d123dbab9d487aa32fb6e291ff8@backblaze.com/KnoxiteTestRepo failed: Invalid repository url specified
  6.  
  7. // In backend.go
  8. ..
  9. case "dropbox":
  10. return NewStorageDropbox(*u), nil
  11. case "backblaze":
  12. return NewStorageBackblaze(*u)
  13. ....
  14.  
  15. // In storage_backblaze.go
  16. func NewStorageBackblaze(URL url.URL) (*StorageBackblaze, error) {
  17. // Checking username and password
  18. if URL.User.Username() == "" {
  19. return &StorageBackblaze{}, nil
  20. }
  21. pw, pwexist := URL.User.Password()
  22. if pwexist {
  23. return &StorageBackblaze{}, ErrInvalidPassword
  24. }
  25.  
  26. // Creating a new Client for accessing the B2 API
  27. cl, err := backblaze.NewB2(backblaze.Credentials{
  28. AccountID: URL.User.Username(),
  29. ApplicationKey: pw,
  30. })
  31. if err != nil {
  32. return &StorageBackblaze{}, err
  33. }
  34. // Creating the bucket
  35. bucket, err := cl.CreateBucket(URL.Path, backblaze.AllPrivate)
  36. if err != nil {
  37. return &StorageBackblaze{}, err
  38. }
  39.  
  40. return &StorageBackblaze{
  41. url: URL,
  42. chunkFile: URL.Path + "_chunks",
  43. snapshotFile: URL.Path + "_snapshots",
  44. repositoryFile: URL.Path + "_repository",
  45. bucket: bucket,
  46. backblaze: cl,
  47. }, nil
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement