Skip to content

Request: Custom Flysystem adapter #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rvmourik opened this issue Feb 22, 2016 · 11 comments
Closed

Request: Custom Flysystem adapter #224

rvmourik opened this issue Feb 22, 2016 · 11 comments

Comments

@rvmourik
Copy link

Issue Type:

Feature Idea

Bundle Version:

Master

Summary:

It's possible to use flysystem, but it's not possible to specify a self created adapter. We're using rackspace connected to an Object Store. It would be nice if a specific service can be specified:

                    public:
                        driver: Flysystem
                        path: ''
                        flysystem:
                              type: **custom | service_adapter**
                              options:
                                  service: **name_of_flysystem_service_adapter**
                                  local:
                                      path: %kernel.root_dir%/../web/uploads/
                        upload_allow: ['all']

Is this something you'd consider to implement, or am i missing something and is this already possible.

Greetings,

Robbert

@rvmourik
Copy link
Author

rvmourik commented Mar 9, 2016

Hi @helios-ag

Any estimate on when this is on the roadmap?

Thanks.

@helios-ag
Copy link
Owner

Hi Robbert!
Well its a nice feature, but will require some way to read options from configuration files (because you need to define some options for your 'driver')(actually this type of options is already implemented in FMBBCodeBundle). Other option is contribute to flysystem your custom rackspace driver, and we will add its options to configuration reader class.

@rvmourik
Copy link
Author

Hi, there already is a generic flysystem rackspace adapter, but that one isn't implemented either. So if that's one is supported is general that would be an improvement.

However it's possible you have multiple drivers, for let's say public and private files. So in that case it would be nice for something like my proposal.

@helios-ag
Copy link
Owner

Hi, there already is a generic flysystem rackspace adapter, but that one isn't implemented either. So if that's one is supported is general that would be an improvement.

I'll take a look on it.

However it's possible you have multiple drivers, for let's say public and private files. So in that case it would be nice for something like my proposal.

Agreed i will try to implement this feature during weekend

@rvmourik
Copy link
Author

@helios-ag Good to hear that :-)

@helios-ag
Copy link
Owner

Rackspace driver support introduced, but needs someone to review it, also added driver_options node that can be used for storing different settings regardless to driver. Unfortunately seems there is no way to write universal driver for all flysystem drivers, because of their instantiation, which differs from driver to driver. Only way here is to write own configuration reader.

@rvmourik
Copy link
Author

Hi @helios-ag

I will try to test it end of this week or on monday.

Maybe another option would be, to set a custom service as adapter through the config.

The service would need to return a Filesystem Object, this way all custom configuration is done in the service, so their would be no need for the bundle to take care of this.

Thanks for the Rackspace integration.

@helios-ag
Copy link
Owner

Custom adapter support introduced, description how to use it here.

@rvmourik
Copy link
Author

@helios-ag looks very nice, like i said will try to test this tomorrow and otherwise on monday!

Cheers

@rvmourik
Copy link
Author

Hi @helios-ag

2 days of delay but found time to test it, the functionality works in general. In my case i tweaked it a little, not sure if this is something you'll be integrating (i forgot to mention this explicitly in an earlier stage). But i think both ideas are solid improvements to your bundle :-)

Below the code of my tweak, i do not have a custom service adapter i have a custom filesystem service (based on another adapter)

case 'custom':
     $service = $this->container->get($serviceName);

     if (is_object($service) && $service instanceof Filesystem) {
           $filesystem = $service;
     }

     if (is_object($service) && $service instanceof AdapterInterface) {
           $filesystem = new Filesystem($service);
     }

     break;

This is needed with the below configuration:

oneup_flysystem:
    adapters:
        adiuvo_cms_adapter_public:
            rackspace:
                lazy: true
                container: adiuvo_cms.opencloud_public_container

    filesystems:
        adiuvo_cms_public:
            adapter: adiuvo_cms_adapter_public
            alias: filesystem_public
            plugins:
              - adiuvo_cms.flysystem.plugin.rackspace_public_url

Thanks so far.

@helios-ag
Copy link
Owner

Hi @rvmourik, thanks for sharing! I will add your case to docs and improve bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants