-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI specific config file #5581
Add CLI specific config file #5581
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I like the idea.
Any thoughts if this could cause problems elsewhere, @bastianallgeier @lukasbestle?
In theory it could clash with a host named So I'd say it should be safe. |
@lukaskleinschmidt Would you mind adding unit tests for this? Once with cli active and extra config loading, once with inactive and ignoring the cli config file? You can force the cli state for testing as done here https://github.com/getkirby/kirby/blob/develop/tests/Http/EnvironmentTest.php#L223-L231 |
I will try to get to it. But currently too busy |
I really like it as well! |
I had the same issue locally regarding the failed test https://github.com/getkirby/kirby/actions/runs/6429036429/job/17457332224?pr=5581 but wanted to make sure this is not related to my setup. Changing the test case for the failing test would fix the issue. But not sure if this is the proper way to do this here. public function testOptionsFromInvalidHost()
{
$env = new Environment([
'cli' => false, // <- this one here
'allowed' => [
'http://example.de'
]
], [
'SERVER_NAME' => 'example.com'
]);
$this->assertSame([], $env->options($this->config));
} |
@lukaskleinschmidt I think that would be the correct solution. The test assumes an HTTP request with the |
This PR …
Adds the option to define a CLI specific config file
config.cli.php
. You can already do something like this by using theready
callback and define your CLI specific options in there. Probably only for edge cases but when you need CLI specific options I think this would fit in quite nicely with the current system of environment (host name or ip address) specific options.Related: https://discord.com/channels/525634039965679616/525641819854471168/1149657559746224188
Breaking changes
Hopefully none.
Ready?
For review team