(remoteUri, endpoint, accessKeyId, secretAccessKey string)
| 126 | } |
| 127 | |
| 128 | func ConstructStorageConfig(remoteUri, endpoint, accessKeyId, secretAccessKey string) (*ObjectStorageConfig, string, error) { |
| 129 | provider, remotePath, err := parseProviderAndPath(remoteUri) |
| 130 | if err != nil { |
| 131 | return nil, "", fmt.Errorf("failed to parse remote path: %w", err) |
| 132 | } |
| 133 | |
| 134 | region, err := parseRegionFromEndpoint(provider, endpoint) |
| 135 | if err != nil { |
| 136 | return nil, "", fmt.Errorf("failed to parse region from endpoint: %w", err) |
| 137 | } |
| 138 | |
| 139 | storageConfig := &ObjectStorageConfig{ |
| 140 | Provider: provider, |
| 141 | Endpoint: endpoint, |
| 142 | AccessKeyId: accessKeyId, |
| 143 | SecretAccessKey: secretAccessKey, |
| 144 | Region: region, |
| 145 | } |
| 146 | |
| 147 | return storageConfig, remotePath, nil |
| 148 | } |
| 149 | |
| 150 | func parseBucketAndPath(fullPath string) (string, string) { |
| 151 | parts := strings.SplitN(fullPath, "/", 2) |
no test coverage detected