Skip to content

Commit

Permalink
config:cache command
Browse files Browse the repository at this point in the history
  • Loading branch information
gecche committed Mar 10, 2019
1 parent ce41819 commit 6b8c2a1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]
### Added
- This CHANGELOG.md file.
- Added the handling of config:cache artisan command by multiple cache config files

## 1.1.0 - 2018-06-24
### Added
- Initial version for Laravel 5.5.

[Unreleased]: https://github.com/gecche/laravel-multidomain/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ php artisan domain:update_env --domain_values='{"TOM_DRIVER":"TOMMY"}'

adds the line `TOM_DRIVER=TOMMY` to all the found environment files.

#### config:cache artisan command
The config:cache artisan command can be used with this package in the same way as any other
artisan command. Be careful that in our setting the config:cache command generates
a file config.php file for each domain under which the command has been executed.
I.e. the command
```
php artisan config:cache --domain=site2.com
```
will generate the file
```
config-site2_com.php
```


#### Further information
At run-time, the current HTTP domain is maintained in the laravel container
and can be accessed by its `domain()` method added by this package.
Expand Down
12 changes: 12 additions & 0 deletions src/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,16 @@ public function domainStoragePath()
}


/**
* Get the path to the configuration cache file.
*
* @return string
*/
public function getCachedConfigPath()
{
$envFile = $this->environmentFile();
if ($envFile && $envFile == '.env')
return $this->bootstrapPath().'/cache/config.php';
return $this->bootstrapPath().'/cache/config-'.domain_sanitized($this['domain']).'.php';
}
}

0 comments on commit 6b8c2a1

Please sign in to comment.