-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Cli - Deault domain/host - for generating routes #47
Comments
I agree that this problem should be addressed, but I think this is a wrong place. |
Ahh .. somehow missed that it can be fixed with that ... damn :) |
Why don't you use nextras/link-factory? |
@JanTvrdik Because it has all the same problems in CLI as any other Nette router. |
I think we can close it, because it's easy to setup http.url address in CLI directly or via extension. $builder->getDefinition('http.request')
->setClass(Request::class, [new Statement(UrlScript::class, ['https://my.url'])]); Right @dg @JanTvrdik @xificurk ? |
@f3l1x No, HTTP request should not be a service... See the discussion on the public Slack. |
@Majkl578 Well, it's pretty cool, but in nette 2.4 and lower there is httpRequest as service, so I've posted a hint how to do it. This issue is not about to make httpService non-service. |
I disagree with closing this. There should be a configurable default for cli. http://symfony.com/doc/current/console/request_context.html |
I see your point @fprochazka. Should I prepare a PR? http:
url: nette.org http:
cli: nette.org Or something like that? |
Current Nette\Http\RequestFactory doesnt support adding default domain for the request
Problems starts when we need to generate links, after executing the script in CLI
eg.:
Whole problem could be solved by adding support for default values for domain and adding a bit of code for using them inside RequestFactory::createHttpRequest() method
this->domain
should be populated by setter function, with DI in setupAnother sollution is to use change RequestFactory to be easily extendebale, currently if we want to override createHttpRequest(), with own implementation, it fail when when the script tries to write to
$this->binary
as there is private access on the variable.For easier extendebility createHttpRequest should be split to smaller pieces. eg. process Query, Hostnamem, Scheme, Binary, etc.
Bellow are 2 current solutions for the problem,
bootstrap.php:
CliHttpRequestExtension.php
CliRequestFactory.php - direct copy of Request factory except added part after line 94
The text was updated successfully, but these errors were encountered: