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