KnpGaufette / Symfony2 / AmazonS3

I am trying to combine Symfony2, KnpGaufetteBundle and Amazon S3. From the KnpGaufette package, I got the xml definition for my configuration. But this is in xml and my configuration is in yml. And for some reason I can’t lower my head. How to 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> 

Full Solution Update

So, in order to actually make it work, we not only have to postpone the configuration in yml (which was solved by chmeliuk β†’ thanks), but we also need to configure the cacert.pem file for curling. You can get the correct form here: http://curl.haxx.se/ca/cacert.pem

Now put this where you want, and then use the following lines with an extra 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 problem, which could otherwise occur.

+4
source share
1 answer

same configuration, but in yml format.

 services: acme.s3: class: AmazonS3 arguments: options: { key: %acme.aws_key%, secret: %acme.aws_secret_key% } 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 

to define parameters such as:% acme.aws_key%,% acme.aws_secret_key%,% acme.s3.bucket_name% add the following lines to the project.yml parameter file (or to the same configuration where you define services):

 parameters: acme.aws_key: YOUR_AWS_KEY acme.aws_secret_key: YOUR_AWS_SECRET_KEY acme.s3.bucket_name: cool_bucket_name 
+5
source

Source: https://habr.com/ru/post/1439139/


All Articles