Skip to content

Commit

Permalink
Fix configuration and namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
1josefnevoral committed Jun 17, 2014
1 parent 2ad6b4f commit 2540d8b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ errorCollector:
projectName: hotelquickly
s3:
accessKeyId:
secretAccessKeyId:
secretAccessKey:
region: 'ap-southeast-1'
```

Expand All @@ -31,11 +31,11 @@ Full configuration list
errorCollector:
s3:
accessKeyId:
secretAccessKeyId:
secretAccessKey:
region: 'ap-southeast-1'
bucket: hq-error-log
logDirectory: %appDir%/../log/
errorStorage: '\HQ\Storage\S3Storage'
errorStorage: '\HQ\ErrorCollector\Storage\S3Storage'
```

### Add presenter with action for cron
Expand Down
2 changes: 1 addition & 1 deletion src/ErrorCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HQ\ErrorCollector;

use HQ\Storage\IErrorStorage;
use HQ\ErrorCollector\Storage\IErrorStorage;
use Nette\Object;

/**
Expand Down
18 changes: 7 additions & 11 deletions src/ErrorCollectorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class_alias('Nette\Config\CompilerExtension', 'Nette\DI\CompilerExtension');
class ErrorCollectorExtension extends Nette\DI\CompilerExtension {

private $defaults = array(
'logDirectory' => '%appDir%/../log/errorCollector.log',
'errorStorage' => '\HQ\Storage\S3Storage',
'logDirectory' => '%appDir%/../log/',
'errorStorage' => '\HQ\ErrorCollector\Storage\S3Storage',
'bucket' => 'hq-error-log'
);

Expand All @@ -27,26 +27,22 @@ public function loadConfiguration()
$config = $this->getConfig($this->defaults);

$storage = null;
if ($config['errorStorage'] === '\HQ\ErrorStorage\S3Storage') {
if ($config['errorStorage'] === '\HQ\ErrorCollector\Storage\S3Storage') {
$builder->addDefinition($this->prefix('S3Proxy'))
->setClass('HQ\Storage\S3Storage', array(
'accessKeyId' => $config['accessKeyId'],
'secretAccessKeyId' => $config['secretAccessKeyId'],
'region' => $config['region']
));
->setClass('HQ\AwsProxy\S3Proxy', array($config['s3']));

$builder->addDefinition($this->prefix('storage'))
->setClass('HQ\Storage\S3Storage', array(
->setClass('HQ\ErrorCollector\Storage\S3Storage', array(
'projectName' => $config['projectName'],
's3Bucket' => $config['bucket'],
$this->prefix('@S3Proxy')
's3Proxy' => '@errorCollector.S3Proxy'
));
}

$builder->addDefinition($this->prefix('errorCollector'))
->setClass('HQ\ErrorCollector\ErrorCollector', array(
'logDirectory' => $config['logDirectory'],
'errorStorage' => $this->prefix('storage')
'errorStorage' => '@errorCollector.storage'
));
}
}
2 changes: 1 addition & 1 deletion src/Storage/IErrorStorage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HQ\Storage;
namespace HQ\ErrorCollector\Storage;

/**
* Interface for saving files to storage
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/S3Storage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace HQ\Storage;
namespace HQ\ErrorCollector\Storage;

use HQ\AWSProxy\S3Proxy;

Expand Down

0 comments on commit 2540d8b

Please sign in to comment.