Skip to content

[9.x] Update dd function when running on virtualized dev environments #44360

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
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
17 changes: 16 additions & 1 deletion src/Illuminate/Foundation/Http/HtmlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ protected function getDumpSourceContent()
$source = sprintf('%s%s', $relativeFile, is_null($line) ? '' : ":$line");

if ($editor = $this->editor()) {
$editorProjectPath = $this->editorProjectPath();
Copy link
Member

Choose a reason for hiding this comment

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

There is no way to infer the project's path, so the user don't have to hardcode it on his configuration file / environment variables?

Copy link
Contributor

@fabio-ivona fabio-ivona Sep 29, 2022

Choose a reason for hiding this comment

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

I don't think you can get the host path from inside a docker container. Also, this feature would be useful for opening local files from a dd() on a remote server

Maybe it could be useful to use a single env value for both ingnition and dd() features (for ignition is currently used IGNITION_LOCAL_SITES_PATH)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, there is no way to automatically infer the project's path as the editor that the users use.
That's why I have the user hardcode it.

Unfortunately, I have no idea.
Do you have any solution?

Copy link
Author

@jevouslue jevouslue Sep 29, 2022

Choose a reason for hiding this comment

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

@fabio-ivona
It sounds good!
IGNITION_EDITOR and IGNITION_LOCAL_SITES_PATH is suitable for them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use a more general key, like (EDITOR_BASE_PATH) and ask to Spatie to support that one as well

using "IGNITION" for this feature doesn't seem consistent to me

$source = sprintf(
'<a href="%s://open?file=%s%s">%s</a>',
$editor,
$file,
$editorProjectPath ? "$editorProjectPath/$relativeFile" : $file,
is_null($line) ? '' : "&line=$line",
$source,
);
Expand All @@ -158,4 +159,18 @@ protected function editor()
// ...
}
}

/**
* Get the base path for the editor, if applicable.
*
* @return string|null
*/
protected function editorProjectPath()
{
try {
return config('app.editor_project_path');
} catch (Throwable $e) {
// ...
}
}
}