-
Notifications
You must be signed in to change notification settings - Fork 7
/
bitbucket.go
40 lines (34 loc) · 1.08 KB
/
bitbucket.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"os"
"gitlab.com/tozd/go/errors"
"github.com/jonhadfield/githosts-utils"
)
func Bitbucket(backupDir string) *ProviderBackupResults {
logger.Println("backing up BitBucket repos")
bitbucketHost, err := githosts.NewBitBucketHost(githosts.NewBitBucketHostInput{
Caller: appName,
HTTPClient: httpClient,
APIURL: os.Getenv(envBitBucketAPIURL),
DiffRemoteMethod: os.Getenv(envBitBucketCompare),
BackupDir: backupDir,
User: os.Getenv(envBitBucketUser),
Key: os.Getenv(envBitBucketKey),
Secret: os.Getenv(envBitBucketSecret),
BackupsToRetain: getBackupsToRetain(envBitBucketBackups),
LogLevel: getLogLevel(),
})
if err != nil {
return &ProviderBackupResults{
Provider: providerNameBitBucket,
Results: githosts.ProviderBackupResult{
BackupResults: []githosts.RepoBackupResults{},
Error: errors.Wrap(err, "failed to create BitBucket host"),
},
}
}
return &ProviderBackupResults{
Provider: providerNameBitBucket,
Results: bitbucketHost.Backup(),
}
}