bernhard Posted February 12, 2022 Share Posted February 12, 2022 I'm using DDEV now for my local development and there's one thing that I'm missing: I can't click on links on error screens or in the dump bar, because the files live inside docker ( /var/www/html/... ) whereas I have them in my IDE (on my host) at ~/foo/bar While looking for a solution I saw in the code that there's already the localRootPath config setting, but this does not solve the problem I think. The reason is that it seems to work only on live systems? Why? First, I have to force tracy into DEV locally due to the issue we talked about lately (on DDEV the detection does not work). Second, we work in a team and everybody has a different local root path. That means we'd need to put that in a config file that is custom for each user. Or maybe you have an idea for a better solution? The thing is we can't even define something like this: [ 'bernhard' => '/Users/bernhard/siteX/', 'adrian' => '/Users/adrian/siteX/', ] because we all use the same admin user on local dev... That's why I think it would be best to have a config setting that we can all put in our config-local.php which is not shared via GIT Thx! 1 Link to comment Share on other sites More sharing options...
teppo Posted February 12, 2022 Share Posted February 12, 2022 Same issue here in terms of links pointing to wrong location (virtualbox based dev environment). Not a big deal for me personally, but sure it would be nice if they worked. Just had a look and I'm wondering if there's a real need for the "Only used if you are viewing a live site" part — why does it work like that, and could it be overridden somehow? I guess it makes sense if "local" means that you're literally developing on the local machine without any extra layers, but since "local" is also used to identify other whether this is a "development environment" vs. "production environment", this is indeed problematic ? 31 minutes ago, bernhard said: because we all use the same admin user on local dev... That's why I think it would be best to have a config setting that we can all put in our config-local.php which is not shared via GIT Developer specific config file would also make sense because the developer is not necessarily logged in when viewing Tracy panels. It'd be even harder to distinguish between guests ? 1 Link to comment Share on other sites More sharing options...
adrian Posted February 12, 2022 Share Posted February 12, 2022 HI @bernhard and @teppo - The local root path was designed as a way to override the path to the remote server so that you could open the file locally even though you clicked from a remote server. I am certainly happy to add user specific paths for these if it helps. Let me know what you think the best approach would be. Can we go with: userid: path pairs on separates lines in a textarea? What about covering @teppo's point about when you're not logged in? Link to comment Share on other sites More sharing options...
adrian Posted February 12, 2022 Share Posted February 12, 2022 Maybe we need a way for all of Tracy's setting (via the $config->tracy option) to be user specific? Would it makes sense to have something like: $config->tracy = [ 41 => [ 'outputMode' => 'development', 'guestForceDevelopmentLocal' => true, 'forceIsLocal' => true, 'localRootPath' => '/xxxx/path/to/' ], 1276 => [ 'outputMode' => 'development', 'localRootPath' => '/yyyy/path/to/' ] ]; where the top level keys are the user IDs? Although of course that doesn't work if you're not logged in. How do you suggest we handle that? I separate config file outside the root of the site so it's not part of the version control of the repo? Link to comment Share on other sites More sharing options...
bernhard Posted February 12, 2022 Author Share Posted February 12, 2022 2 hours ago, adrian said: Maybe we need a way for all of Tracy's setting (via the $config->tracy option) to be user specific? I tried to explain before that this would not work for me (us). At work we work on the same project with the same users but on different machines (meaning also on different disk paths). That means one developer needs to set the path to /Users/one/project and the other developer needs to set it to /Users/two/project and maybe another dev on windows would set it to c:/laragon/www/project We can't put that into a textarea of tracy because we are all logged in as "admin" (or whatever). We have one config that we all share and that is checked into git that lives in /site/config.php; This config then loads a local config that is not part of git and that is where we could add user-specific settings like the path to the docroot. I hope it's now better to understand and I'm looking forward to hearing what teppo thinks ? Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2022 Share Posted February 13, 2022 Sorry, I must admit I read in a rush this morning and assumed your example was an option, but just noticed you're saying that it's not an option. I have always worked solo (although that is about to change), so I will defer to you both to let me know how you'd like this set up - I am happy to implement whatever you suggest on this. 1 Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2022 Share Posted February 13, 2022 5 hours ago, bernhard said: This config then loads a local config that is not part of git and that is where we could add user-specific settings like the path to the docroot. In that case, can't you simply append to (or replace) $config->tracy in this local config file? If that works for you, I think all I need to do is to remove the isLocal() check that currently prevents this working unless on a live server. Does that sound correct? 2 Link to comment Share on other sites More sharing options...
teppo Posted February 13, 2022 Share Posted February 13, 2022 6 hours ago, adrian said: I think all I need to do is to remove the isLocal() check that currently prevents this working unless on a live server. Does that sound correct? Correct ? 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 13, 2022 Author Share Posted February 13, 2022 7 hours ago, adrian said: In that case, can't you simply append to (or replace) $config->tracy in this local config file? If that works for you, I think all I need to do is to remove the isLocal() check that currently prevents this working unless on a live server. Does that sound correct? It sounds correct but I'm not sure if that works. On my end it does not. Not sure if I did anything wrong though. I set this: $config->tracy = [ 'outputMode' => 'development', 'guestForceDevelopmentLocal' => true, 'forceIsLocal' => true, 'localRootPath' => '/foo/bar', ]; And I modified createEditorLink: public static function createEditorLink($file, $line, $linkText, $title = null) { bd(self::getDataValue('localRootPath')); if(strpos($file, '..') !== false) return; $file = str_replace("%file", $file, str_replace("%line", $line, Debugger::$editor)); $file = static::forwardSlashPath($file); if(static::$useOnlineEditor) $file = str_replace(static::$onlineFileEditorDirPath, '', $file); elseif(self::getDataValue('localRootPath') != '') $file = str_replace(wire('config')->paths->root, self::getDataValue('localRootPath'), $file); return '<a '.($title ? 'title="'.$title.'"' : '').' href="'.$file.'">'.$linkText.'</a>'; } But the localRootPath is empty unless I type something in the tracy config inputfield and save that. Thx for your help, it will be another little detail that will make me faster and happier every day ? Link to comment Share on other sites More sharing options...
teppo Posted February 13, 2022 Share Posted February 13, 2022 6 hours ago, bernhard said: It sounds correct but I'm not sure if that works. On my end it does not. Not sure if I did anything wrong though. ... But the localRootPath is empty unless I type something in the tracy config inputfield and save that. With identical modification this is working fine for me. Are other config variables working as expected? Any chance that there's a compiled version or some sort of cache in play here? 2 Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2022 Share Posted February 13, 2022 @bernhard - I'm with @teppo - it works for me - that bd() call you added correctly returns the path set via: $config->tracy = [ 'localRootPath' => '/path/to' ]; so I think there is something else that must be awry at your end. As he asked, are other settings defined that way working as expected? 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 13, 2022 Author Share Posted February 13, 2022 Weird... it does also work now on my end! I'm not aware of any changes, but I had to copy over the new method from my previous post. Maybe I was in the wrong file or whatever on my first try... Ok that means we can simply use my modified method without the bd() ? ? 1 Link to comment Share on other sites More sharing options...
adrian Posted February 13, 2022 Share Posted February 13, 2022 Give the latest version a go. There was one other place that needed the isLocal check removed. 1 1 Link to comment Share on other sites More sharing options...
bernhard Posted February 14, 2022 Author Share Posted February 14, 2022 Works great, thank you very much!! 2 Link to comment Share on other sites More sharing options...
bernhard Posted February 15, 2022 Author Share Posted February 15, 2022 I think I was just missing a modules refresh when it did not work. I updated another version today and was wondering why it did not work. Modules refresh helped ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now