8000 [FrameworkBundle] URL for setting the request context · Issue #35121 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] URL for setting the request context #35121

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

Closed
alanpoulain opened this issue Dec 27, 2019 · 2 comments · Fixed by #36651
Closed

[FrameworkBundle] URL for setting the request context #35121

alanpoulain opened this issue Dec 27, 2019 · 2 comments · Fixed by #36651

Comments

@alanpoulain
Copy link
Contributor

Description
Today when we want to change the generated URLs in commands, we need to set a lot of parameters (scheme, host, port, ...): https://symfony.com/doc/current/routing.html#generating-urls-in-commands.

It could be useful and less cumbersome to set an URL instead. It would be parsed in a compiler pass and the parameters would be set there.

Example
Before:

# config/services.yaml
parameters:
    router.request_context.scheme: 'https'
    router.request_context.host: 'example.org'
    request_listener.https_port: 8443

After:

# config/services.yaml
parameters:
    router.request_context.url: 'https://example.org:8443'
@pyatnitsev
Copy link

I think, I can try to do that. I think this case can be solved next way:

  1. Create new CompillerPass, that check new parameter
  2. Parse url and put parsed parameters into old vars

WDYT?

@nicolas-grekas
Copy link
Member

Implemented in #36651

@fabpot fabpot closed this as completed May 4, 2020
fabpot added a commit that referenced this issue May 4, 2020
…RI with a DSN (nicolas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Allow configuring the default base URI with a DSN

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fixes #35121, replaces #35580, partially reverts #35281
| License       | MIT
| Doc PR        | -

Instead of defining 3-4 parameters, this PR enables using a single DSN to configure the default URL context (for commands mainly):
```
framework:
	router:
		base_uri: 'https://my.host:8443/base-path/'
```

When using parameters directly, one can now set the same absolute URI in the `router.request_context.base_url` parameter, this will provide the same benefit.

Commits
-------

250fa7e [FrameworkBundle] Allow configuring the default base URI with a DSN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
0