debug
This commit is contained in:
parent
16c9a31a07
commit
ab393251eb
|
@ -3,6 +3,7 @@
|
|||
namespace Bluesquare\StorageBundle\Adaptors;
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
|
||||
/**
|
||||
* Interface de manipulation du stockage S3
|
||||
|
@ -18,10 +19,16 @@ class S3Storage
|
|||
protected $bucket;
|
||||
protected $region;
|
||||
|
||||
private $required_config_field = ['bucket', 'region', 'endpoint', 'credientials'];
|
||||
|
||||
public function __construct ($storage_name, $config)
|
||||
{
|
||||
// TODO: on check la présence de "bucket", "region", "endpoint", "credentials" ("key", "secret") dans $config
|
||||
|
||||
if ($this->configIsNotNormed($config))
|
||||
throw new Exception("Error from config file :(");
|
||||
// if (isset($config['bucket']) && isset($config))
|
||||
|
||||
$this->config = $config;
|
||||
$this->bucket = $config['bucket'];
|
||||
|
||||
|
@ -36,6 +43,12 @@ class S3Storage
|
|||
]);
|
||||
}
|
||||
|
||||
private function configIsNotNormed($config)
|
||||
{
|
||||
dump(array_diff($this->required_config_field, $config)); die;
|
||||
// return ()
|
||||
}
|
||||
|
||||
protected function getPrefix($prefix = null)
|
||||
{
|
||||
$ret = '';
|
||||
|
|
|
@ -20,14 +20,14 @@ class Configuration implements ConfigurationInterface
|
|||
$root->useAttributeAsKey('storage_name')
|
||||
->prototype('array')
|
||||
->children()
|
||||
->scalarNode('type')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('bucket')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('region')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('endpoint')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('type')->end()
|
||||
->scalarNode('bucket')->end()
|
||||
->scalarNode('region')->end()
|
||||
->scalarNode('endpoint')->end()
|
||||
->arrayNode('credentials')
|
||||
->children()
|
||||
->scalarNode('key')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()
|
||||
->scalarNode('key')->end()
|
||||
->scalarNode('secret')->end()
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('version')->end()
|
||||
|
|
Loading…
Reference in New Issue