Open watzon opened 4 years ago
Done. I am currently working on Attacher
class, that will give an ability to start working on a ORM adapters (you can read more about it here: https://twin.github.io/upcoming-features-in-shrine-3-0).
As soon as Attacher
will be done, I will notify you.
Perfect. I just need that and a working S3/Minio backend and I'll be golden. Thanks for this!
@watzon what best (at least working) library for AWS S3 you can suggest?
There's only one existing library that I know of, and I don't know if it's been kept up to date. I'll look into it tomorrow for sure.
I added new issue: #2, let's continue discussion about S3 in it.
I am in the same boat as @watzon. Having Attacher
and AWS S3 support would be awesome.
@wout I am currently working on Attacher
. Will try to find somebody to implement S3 support.
@igor-alexandrov Great, thanks for letting me know. Just out of interest, are you porting shrine as-is? Or are you putting your twist on it?
@wout I started this as a complete port of Ruby library, but actually it already differs a lot. So I am open to suggestions.
I'm happy to help with implementing S3 and Avram support.
@smadeja the good news is that @Arina1004 is already working on S3 support and I believe we will release it pretty soon. So, let's focus on ORM adapters. I will prepare branch with Shrine::Attacher
class tomorrow and we can start.
@smadeja, @wout, @watzon I pushed feature/attacher
branch.
Now we can start working on ORM adapters. Based on this article https://twin.github.io/upcoming-features-in-shrine-3-0/, it will work like this:
attacher = Shrine::Attacher.new
attacher.assign(file) # uploads file
attacher.file #=> #<Shrine::UploadedFile id="abc123.jpg" storage=:store ...>
# ...
attacher.data #=>
# {
# "id" => "abc123.jpg",
# "storage" => "store",
# "metadata" => {
# "size" => 9534842,
# "filename" => "nature.jpg",
# "mime_type" => "image/jpeg",
# }
# }
Let's move S3 discussion to the #2, as I already said @Arina1004 is already working on it.
What I am looking for now is:
Shrine::Attachment
I pushed a code with a Column plugin to feature/attacher
branch. Now you can do the following:
Attacher.from_column('{"id":"...","storage":"...","metadata":{...}}')
# ...
attacher.file #=> nil
attacher.load_column('{"id":"...","storage":"...","metadata":{...}}')
attacher.file #=> #<Shrine::UploadedFile>
# ...
attacher.column_data #=> '{"id":"...","storage":"...","metadata":{...}}'
I am still working on specs and final API, but it looks pretty good even now.
Thanks for your work on this. I'm going to take it for a spin with Avram and report back.
@wout feel free to contact me if you have any questions.
hey @igor-alexandrov I could make it work with Avram, my solution is a little bit weird (there are a few points that can be improved), but at least I could make it work with Lucky/Avram/S3
if you'd like we can collaborate to add support to shrine itself (best option 😄 )
thank for all your work on shrine!
@fernandes great! I also started working on Avram integration. Can you please share your code?
hello @igor-alexandrov , I isolated and tried to simplify the most I could to make it easier to read, in this first example I'm using local store, after you implement, we can add support for S3 store and provide signed URLs for private images (I got it working with DO and Vultr S3 provider)
the URL signed is just one method, the idea is make it work out of the box on Lucky, but we need to re-use data from the config, possibly we can use Habitat
to make it easier to handle
https://gist.github.com/fernandes/31c56b5aa1841643958031dc24c6a86b
Wondering if any progress has been made here? I'm once again working on a project where it would be very useful.
@watzon unfortunately no... I hope, I will have time to work on this somewhere in December.
Avram is the Lucky Framework's ORM, and as Lucky is currently one of the best built (my opinion) and most popular web frameworks for Crystal it would make sense to make an adapter for it. I'd be happy to work on it as soon as another adapter has been written for me to go off of.