(config []byte)
| 52 | } |
| 53 | |
| 54 | func (s *S3StorageBackend) FromJSONConfig(config []byte) (Storage, error) { |
| 55 | var conf S3StorageConfig |
| 56 | err := json.Unmarshal(config, &conf) |
| 57 | if err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | hash := conf.Hash() |
| 61 | if storage, ok := s.cache.Get(hash); ok { |
| 62 | return storage, nil |
| 63 | } |
| 64 | store := S3Storage{ |
| 65 | endpoint: conf.Endpoint, |
| 66 | bucket: conf.Bucket, |
| 67 | access: conf.Access, |
| 68 | secret: conf.Secret, |
| 69 | } |
| 70 | store.ensureClient() |
| 71 | s.cache.Add(hash, &store) |
| 72 | return &store, nil |
| 73 | } |
| 74 | |
| 75 | func (s *S3StorageBackend) ValidateJSONConfig(config []byte) error { |
| 76 | var conf S3StorageConfig |
nothing calls this directly
no test coverage detected