-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
36 lines (31 loc) · 892 Bytes
/
config.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
package objstr
import (
"github.com/agnosticeng/objstr/backend/impl/fs"
"github.com/agnosticeng/objstr/backend/impl/http"
"github.com/agnosticeng/objstr/backend/impl/memory"
"github.com/agnosticeng/objstr/backend/impl/redis"
"github.com/agnosticeng/objstr/backend/impl/s3"
"github.com/agnosticeng/objstr/backend/impl/sftp"
)
type BackendConfig struct {
Memory *memory.MemoryBackendConfig
Fs *fs.FSBackendConfig
Http *http.HTTPBackendConfig
S3 *s3.S3BackendConfig
Sftp *sftp.SFTPBackendConfig
Redis *redis.RedisBackendConfig
}
type Config struct {
CopyBufferSize int
DefaultBackend string
BackendConfig
Backends map[string]BackendConfig
}
func (c *Config) WithBackend(scheme string, backendConf BackendConfig) *Config {
c.Backends[scheme] = backendConf
return c
}
func (c *Config) WithCopyBufferSize(size int) *Config {
c.CopyBufferSize = size
return c
}