Closed rfay closed 1 year ago
That sounds great. Is there an environment variable that stores the project directory? I don't think it runs in the project directory because I was not able to refer to relative paths in some of the tests. The idea is that I would have a settings.redis.php and just copy the file if it is Drupal.
Alternatively, I could just copy the file to within the .ddev
directory and then modify the settings.php to include that. Thoughts on this?
As in the example. $DDEV_APPROOT
. See the first set (host-side) of environment variables in https://ddev.readthedocs.io/en/latest/users/extend/custom-commands/#environment-variables-provided
I think putting the file in .ddev should be fine. Really I wish settings.ddev.php lived there.
The one thing to remember for sure though: Unless this is a drupal-specific recipe, it needs to not do things that other CMSs will find objectionable.
@rfay, agreed. In fact, I was exploring the idea of creating another addon specific to Drupal. But I think this is a simple enough conditional. I'll also check on how to not even copy the file if the recipe is not Drupal.
That brings me to a question: can I call a shell script directly from post_install_actions? I suppose I can but the question is how do I get a path of a file I am not copying to .ddev directory.
Yes, that's exactly what you call there. See https://github.com/drud/ddev-drupal9-solr/blob/fcb7de120f937d818cb58a50c0b56e44cb146732/install.yaml#L12 for example.
@rfay, can you review this change?
I eventually copied the file to the settings directory as I couldn't figure out how to get the location of the .ddev
directory from settings.php. I see DDEV_APPROOT
environment variable is not listed under the container scripts section and if that is the host path, then we can use it within the container. I couldn't find out another simpler way to determine this. I wanted to avoid the dirname('../../..')
trick for this because then I would have to factor in the web root.
I didn't try it out, but it looks good. Location of .ddev dir (on host) should be $DDEV_APPROOT/.ddev
. In container, should be /var/www/html/.ddev
Thanks @rfay. I noticed a few problems and so going to move this to a PR.
@rfay, a question: would you still prefer the redis settings file to be within the .ddev
directory? Or is it better it gets copied to be in the same directory as settings.ddev.php
?
I'm fine with it either way. Probably since settings.ddev.php has been (wrongly) in sites/default for so many years it's fine to put it in there.
Thanks for adding the settings, that is a great way to get bootstrapped up. Could it also respect the disable_settings_management
flag?
Wow, @joelpittet - this is a really old issue. Could you please open a new issue and give context for your request? Probably a PR would be fine also.
@rfay Yes for sure https://github.com/drud/ddev-redis/issues/6
This was completed in
On Twitter you mentioned the idea of providing Drupal settings.
It would be possible for the post_install_actions to do something that reached out of .ddev.
For example,
Maybe that's worth a try?