mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-14 22:15:55 +00:00
Allow custom config file path (#145)
* allow custom config file path * Update configuration.md
This commit is contained in:
committed by
GitHub
parent
bded9f754e
commit
f6d04777e1
@@ -37,6 +37,14 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$builtInConfig = config('expose');
|
$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';
|
$localConfigFile = getcwd().DIRECTORY_SEPARATOR.'.expose.php';
|
||||||
|
|
||||||
if (file_exists($localConfigFile)) {
|
if (file_exists($localConfigFile)) {
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ The configuration file will be written to your home directory inside a `.expose`
|
|||||||
|
|
||||||
`~/.expose/config.php`
|
`~/.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:
|
And the default content of the configuration file is this:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|||||||
Reference in New Issue
Block a user