Allow custom config file path (#145)

* allow custom config file path

* Update configuration.md
This commit is contained in:
Siebe Vanden Eynden
2020-12-04 22:45:29 +01:00
committed by GitHub
parent bded9f754e
commit f6d04777e1
2 changed files with 14 additions and 0 deletions

View File

@@ -37,6 +37,14 @@ class AppServiceProvider extends ServiceProvider
{
$builtInConfig = config('expose');
$keyServerVariable = 'EXPOSE_CONFIG_FILE';
if (array_key_exists($keyServerVariable, $_SERVER) && is_string($_SERVER[$keyServerVariable]) && file_exists($_SERVER[$keyServerVariable])) {
$localConfig = require $_SERVER[$keyServerVariable];
config()->set('expose', array_merge($builtInConfig, $localConfig));
return;
}
$localConfigFile = getcwd().DIRECTORY_SEPARATOR.'.expose.php';
if (file_exists($localConfigFile)) {

View File

@@ -17,6 +17,12 @@ The configuration file will be written to your home directory inside a `.expose`
`~/.expose/config.php`
You can also provide a custom location of the config file by providing the full path as a server variable.
```bash
EXPOSE_CONFIG_FILE="~/my-custom-config.php" expose share
```
And the default content of the configuration file is this:
```php