Browse Source
Add storage provider working directory parameter
feature/update-route-registration
Roman Zipp
3 years ago
committed by
Fabian Vowie
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
2 changed files with
5 additions and
4 deletions
-
main.go
-
storage/storage.go
|
@ -42,8 +42,7 @@ func RegisterPipelineRoutes(r *mux.Router, pipelines []pipelines.IPipeline, stor |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|
storageProvider := storage.GetFileSystemStorageProvider("test") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
storageProvider := storage.GetFileSystemStorageProvider("test", "") |
|
|
storageProvider.StoreRaw("abc", "def.test", []byte{0x12, 0x10}) |
|
|
storageProvider.StoreRaw("abc", "def.test", []byte{0x12, 0x10}) |
|
|
|
|
|
|
|
|
pipes := pipelines.LoadPipelines() |
|
|
pipes := pipelines.LoadPipelines() |
|
|
|
@ -39,8 +39,10 @@ func (sp FileSystemStorageProvider) StoreExisting(bucketName string, objectName |
|
|
return sp.StoreRaw(bucketName, objectName, bytesRead) |
|
|
return sp.StoreRaw(bucketName, objectName, bytesRead) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func GetFileSystemStorageProvider(basePath string) FileSystemStorageProvider { |
|
|
|
|
|
wd, _ := os.Getwd() |
|
|
|
|
|
|
|
|
func GetFileSystemStorageProvider(basePath string, wd string) FileSystemStorageProvider { |
|
|
|
|
|
if wd == "" { |
|
|
|
|
|
wd, _ = os.Getwd() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return FileSystemStorageProvider{ |
|
|
return FileSystemStorageProvider{ |
|
|
fileSystem: afero.NewBasePathFs(afero.NewOsFs(), filepath.Join(wd, "files")), |
|
|
fileSystem: afero.NewBasePathFs(afero.NewOsFs(), filepath.Join(wd, "files")), |
|
|