I am trying to combine Symfony2, KnpGaufetteBundle & Amazon S3.
From the KnpGaufette Bundle i got an xml definition to use for my config. But it’s in xml and my config is in yml. And somehow i can’t get my head around it. How do i define the following variables in yml? And what do they mean?
<service id="acme.s3" class="AmazonS3">
<argument type="collection">
<argument key="key">%acme.aws_key%</argument>
<argument key="secret">%acme.aws_secret_key%</argument>
</argument>
</service>
<service id="acme.s3.adapter" class="Gaufrette\Adapter\AmazonS3">
<argument type="service" id="acme.s3"></argument>
<argument>%acme.s3.bucket_name%</argument>
</service>
<service id="acme.fs" class="Gaufrette\Filesystem">
<argument type="service" id="acme.s3.adapter"></argument>
</service>
Update with full Solution
So, to actually get it working, not only do we have to put down the config in yml (which has been solved by chmeliuk -> thanks), but we also need to configure the cacert.pem file for curl.
You can get a proper one here: http://curl.haxx.se/ca/cacert.pem
Now put this wherever you want and then use the following lines with the additional certificate_authority entry:
services:
acme.s3:
class: AmazonS3
arguments:
options: { key: %acme.aws_key%, secret: %acme.aws_secret_key%, certificate_authority: "pathWhereYouDidPutThisFile/cacert.pem" }
acme.s3.adapter:
class: Gaufrette\Adapter\AmazonS3
arguments:
service: @acme.s3
bucket_name: %acme.s3.bucket_name%
acme.fs:
class: Gaufrette\Filesystem
arguments:
adapter: @acme.s3.adapter
This solves the CA Cert cURL Error 60 which you might have otherwise.
same configuration but in yml format.
to define such parameters as: %acme.aws_key%, %acme.aws_secret_key%, %acme.s3.bucket_name% add to your project parameters.yml file (or to same config where you define services) next lines: