Skip to content

Commit

Permalink
Merge 0d2e13d into cfa5bea
Browse files Browse the repository at this point in the history
  • Loading branch information
hollodotme committed May 13, 2018
2 parents cfa5bea + 0d2e13d commit 9f0933a
Show file tree
Hide file tree
Showing 61 changed files with 3,641 additions and 635 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
# local configs
/config/servers.php
/config/app.php
/.redis/data/*
!.gitkeep
1 change: 1 addition & 0 deletions .redis/data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Keep this directory
1,052 changes: 1,052 additions & 0 deletions .redis/redis.default.conf

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .redis/redis.test.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
databases 1
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ php:
- 7.2
- 7.2snapshot

git:
depth: 5

cache:
directories:
- $HOME/.composer/cache/files

branches:
only:
- master
Expand Down
203 changes: 104 additions & 99 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ services:
ports:
- 6379:6379
volumes:
- ./:/repo
- .redis/data:/data
- .redis/redis.default.conf:/usr/local/etc/redis/redis.conf
- ./:/repo
command: /usr/local/etc/redis/redis.conf
20 changes: 18 additions & 2 deletions src/Application/Configs/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace hollodotme\Readis\Application\Configs;

use hollodotme\Readis\Exceptions\ApplicationConfigNotFound;
use function file_exists;
use const PHP_URL_PATH;

final class AppConfig
Expand All @@ -14,9 +16,23 @@ public function __construct( array $data )
$this->configData = $data;
}

public static function fromConfigFile() : self
/**
* @param null|string $configFile
*
* @throws ApplicationConfigNotFound
* @return AppConfig
*/
public static function fromConfigFile( ?string $configFile = null ) : self
{
return new self( (array)include __DIR__ . '/../../../config/app.php' );
$appConfigFile = $configFile ?? dirname( __DIR__, 3 ) . '/config/app.php';

if ( !file_exists( $appConfigFile ) )
{
throw new ApplicationConfigNotFound( 'Could not find application config at ' . $appConfigFile );
}

/** @noinspection PhpIncludeInspection */
return new self( (array)require $appConfigFile );
}

public function getBaseUrl() : string
Expand Down
Loading

0 comments on commit 9f0933a

Please sign in to comment.