Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[WebProfilerBundle] Expose dotenv variables #25166

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
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@
{% endif %}

<h3>Server Parameters</h3>
{{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestserver }, with_context = false) }}
<h4>Managed by Symfony Dotenv</h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined in .env?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets go from there yes. Now updated.

{{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.dotenvvars }, with_context = false) }}

<h4>Standard variables</h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined as regular env variables?

{% set requestserver = [] %}
{% for key, value in collector.requestserver if key not in collector.dotenvvars.keys %}
{% set requestserver = requestserver|merge({(key): value}) %}
{% endfor %}
{{ include('@WebProfiler/Profiler/table.html.twig', { data: requestserver }, with_context = false) }}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ public function collect(Request $request, Response $response, \Exception $except
$responseCookies[$cookie->getName()] = $cookie;
}

$dotenvVars = array();
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$dotenvVars[$name] = $value;
}
}

$this->data = array(
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
Expand All @@ -100,6 +107,7 @@ public function collect(Request $request, Response $response, \Exception $except
'path_info' => $request->getPathInfo(),
'controller' => 'n/a',
'locale' => $request->getLocale(),
'dotenv_vars' => $dotenvVars,
);

if (isset($this->data['request_headers']['php-auth-pw'])) {
Expand Down Expand Up @@ -254,6 +262,11 @@ public function getLocale()
return $this->data['locale'];
}

public function getDotenvVars()
{
return new ParameterBag($this->data['dotenv_vars']->getValue());
}

/**
* Gets the route name.
*
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.