ml-archive/storage

Service Factory fails

bensyverson opened this issue · 1 comments

Following the README, I'm unable to get basic uploading to work. I'm registering an S3Driver with my Services in my configure.swift, and am calling it like this (addPhoto.photo is Data):

try Storage.upload(
	bytes: addPhoto.photo,
	fileName: "example.jpg",
	folder: "photos",
	on: req
)

Vapor is throwing the following error:

[ ERROR ] ServiceError.make: No services are available for 'NetworkDriver'. (Container.swift:112)
[ DEBUG ] Suggested fixes for ServiceError.make: Register a service for 'NetworkDriver'. `services.register(NetworkDriver.self) { ... }`. (ErrorMiddleware.swift:26)

Thanks in advance for taking a look!

For anyone searching, you need to register the service as such:

let driver = try S3Driver()
services.register(driver, as: NetworkDriver.self)

I submitted a PR to address this issue and a couple of other minor things: #57