@@ -16,59 +16,60 @@ import (
1616// Config holds all configuration values that are expected to be set
1717// by users.
1818type Config struct {
19- AwsS3BucketName string `split_words:"true"`
20- AwsS3Path string `split_words:"true"`
21- AwsEndpoint string `split_words:"true" default:"s3.amazonaws.com"`
22- AwsEndpointProto string `split_words:"true" default:"https"`
23- AwsEndpointInsecure bool `split_words:"true"`
24- AwsEndpointCACert CertDecoder `envconfig:"AWS_ENDPOINT_CA_CERT"`
25- AwsStorageClass string `split_words:"true"`
26- AwsAccessKeyID string `envconfig:"AWS_ACCESS_KEY_ID"`
27- AwsAccessKeyIDFile string `envconfig:"AWS_ACCESS_KEY_ID_FILE"`
28- AwsSecretAccessKey string `split_words:"true"`
29- AwsSecretAccessKeyFile string `split_words:"true"`
30- AwsIamRoleEndpoint string `split_words:"true"`
31- AwsPartSize int64 `split_words:"true"`
32- BackupSources string `split_words:"true" default:"/backup"`
33- BackupFilename string `split_words:"true" default:"backup-%Y-%m-%dT%H-%M-%S.tar.gz"`
34- BackupFilenameExpand bool `split_words:"true"`
35- BackupLatestSymlink string `split_words:"true"`
36- BackupArchive string `split_words:"true" default:"/archive"`
37- BackupRetentionDays int32 `split_words:"true" default:"-1"`
38- BackupPruningLeeway time.Duration `split_words:"true" default:"1m"`
39- BackupPruningPrefix string `split_words:"true"`
40- BackupStopContainerLabel string `split_words:"true" default:"true"`
41- BackupFromSnapshot bool `split_words:"true"`
42- BackupExcludeRegexp RegexpDecoder `split_words:"true"`
43- GpgPassphrase string `split_words:"true"`
44- NotificationURLs []string `envconfig:"NOTIFICATION_URLS"`
45- NotificationLevel string `split_words:"true" default:"error"`
46- EmailNotificationRecipient string `split_words:"true"`
47- EmailNotificationSender string `split_words:"true" default:"noreply@nohost"`
48- EmailSMTPHost string `envconfig:"EMAIL_SMTP_HOST"`
49- EmailSMTPPort int `envconfig:"EMAIL_SMTP_PORT" default:"587"`
50- EmailSMTPUsername string `envconfig:"EMAIL_SMTP_USERNAME"`
51- EmailSMTPPassword string `envconfig:"EMAIL_SMTP_PASSWORD"`
52- WebdavUrl string `split_words:"true"`
53- WebdavUrlInsecure bool `split_words:"true"`
54- WebdavPath string `split_words:"true" default:"/"`
55- WebdavUsername string `split_words:"true"`
56- WebdavPassword string `split_words:"true"`
57- SSHHostName string `split_words:"true"`
58- SSHPort string `split_words:"true" default:"22"`
59- SSHUser string `split_words:"true"`
60- SSHPassword string `split_words:"true"`
61- SSHIdentityFile string `split_words:"true" default:"/root/.ssh/id_rsa"`
62- SSHIdentityPassphrase string `split_words:"true"`
63- SSHRemotePath string `split_words:"true"`
64- ExecLabel string `split_words:"true"`
65- ExecForwardOutput bool `split_words:"true"`
66- LockTimeout time.Duration `split_words:"true" default:"60m"`
67- AzureStorageAccountName string `split_words:"true"`
68- AzureStoragePrimaryAccountKey string `split_words:"true"`
69- AzureStorageContainerName string `split_words:"true"`
70- AzureStoragePath string `split_words:"true"`
71- AzureStorageEndpoint string `split_words:"true" default:"https://{{ .AccountName }}.blob.core.windows.net/"`
19+ AwsS3BucketName string `split_words:"true"`
20+ AwsS3Path string `split_words:"true"`
21+ AwsEndpoint string `split_words:"true" default:"s3.amazonaws.com"`
22+ AwsEndpointProto string `split_words:"true" default:"https"`
23+ AwsEndpointInsecure bool `split_words:"true"`
24+ AwsEndpointCACert CertDecoder `envconfig:"AWS_ENDPOINT_CA_CERT"`
25+ AwsStorageClass string `split_words:"true"`
26+ AwsAccessKeyID string `envconfig:"AWS_ACCESS_KEY_ID"`
27+ AwsAccessKeyIDFile string `envconfig:"AWS_ACCESS_KEY_ID_FILE"`
28+ AwsSecretAccessKey string `split_words:"true"`
29+ AwsSecretAccessKeyFile string `split_words:"true"`
30+ AwsIamRoleEndpoint string `split_words:"true"`
31+ AwsPartSize int64 `split_words:"true"`
32+ BackupCompression CompressionType `split_words:"true" default:"gz"`
33+ BackupSources string `split_words:"true" default:"/backup"`
34+ BackupFilename string `split_words:"true" default:"backup-%Y-%m-%dT%H-%M-%S.{{ .Extension }}"`
35+ BackupFilenameExpand bool `split_words:"true"`
36+ BackupLatestSymlink string `split_words:"true"`
37+ BackupArchive string `split_words:"true" default:"/archive"`
38+ BackupRetentionDays int32 `split_words:"true" default:"-1"`
39+ BackupPruningLeeway time.Duration `split_words:"true" default:"1m"`
40+ BackupPruningPrefix string `split_words:"true"`
41+ BackupStopContainerLabel string `split_words:"true" default:"true"`
42+ BackupFromSnapshot bool `split_words:"true"`
43+ BackupExcludeRegexp RegexpDecoder `split_words:"true"`
44+ GpgPassphrase string `split_words:"true"`
45+ NotificationURLs []string `envconfig:"NOTIFICATION_URLS"`
46+ NotificationLevel string `split_words:"true" default:"error"`
47+ EmailNotificationRecipient string `split_words:"true"`
48+ EmailNotificationSender string `split_words:"true" default:"noreply@nohost"`
49+ EmailSMTPHost string `envconfig:"EMAIL_SMTP_HOST"`
50+ EmailSMTPPort int `envconfig:"EMAIL_SMTP_PORT" default:"587"`
51+ EmailSMTPUsername string `envconfig:"EMAIL_SMTP_USERNAME"`
52+ EmailSMTPPassword string `envconfig:"EMAIL_SMTP_PASSWORD"`
53+ WebdavUrl string `split_words:"true"`
54+ WebdavUrlInsecure bool `split_words:"true"`
55+ WebdavPath string `split_words:"true" default:"/"`
56+ WebdavUsername string `split_words:"true"`
57+ WebdavPassword string `split_words:"true"`
58+ SSHHostName string `split_words:"true"`
59+ SSHPort string `split_words:"true" default:"22"`
60+ SSHUser string `split_words:"true"`
61+ SSHPassword string `split_words:"true"`
62+ SSHIdentityFile string `split_words:"true" default:"/root/.ssh/id_rsa"`
63+ SSHIdentityPassphrase string `split_words:"true"`
64+ SSHRemotePath string `split_words:"true"`
65+ ExecLabel string `split_words:"true"`
66+ ExecForwardOutput bool `split_words:"true"`
67+ LockTimeout time.Duration `split_words:"true" default:"60m"`
68+ AzureStorageAccountName string `split_words:"true"`
69+ AzureStoragePrimaryAccountKey string `split_words:"true"`
70+ AzureStorageContainerName string `split_words:"true"`
71+ AzureStoragePath string `split_words:"true"`
72+ AzureStorageEndpoint string `split_words:"true" default:"https://{{ .AccountName }}.blob.core.windows.net/"`
7273}
7374
7475func (c * Config ) resolveSecret (envVar string , secretPath string ) (string , error ) {
@@ -82,6 +83,22 @@ func (c *Config) resolveSecret(envVar string, secretPath string) (string, error)
8283 return string (data ), nil
8384}
8485
86+ type CompressionType string
87+
88+ func (c * CompressionType ) Decode (v string ) error {
89+ switch v {
90+ case "gz" , "zst" :
91+ * c = CompressionType (v )
92+ return nil
93+ default :
94+ return fmt .Errorf ("config: error decoding compression type %s" , v )
95+ }
96+ }
97+
98+ func (c * CompressionType ) String () string {
99+ return string (* c )
100+ }
101+
85102type CertDecoder struct {
86103 Cert * x509.Certificate
87104}
0 commit comments