"value":"\n <p>Here's another <code>run<\/code> file example, this time relating to Git worktrees...<\/p>\n\n<p>One project that I work on is a multilingual Drupal application that needs to work in both English and Welsh. As I'm cloning a fresh version today, I'm doing it as a bare repository so I can use worktrees.<\/p>\n\n<p>To work on it locally, just like in production, I need to use a different URL for each language so that Drupal can identify it and load the correct content and configuration.<\/p>\n\n<p>For fixed environments like production or staging, the URLs are set in configuration files, but for ad-hoc environments such as local worktrees, I thought that the best approach was to override them as needed per worktree using Drush (a Drupal CLI tool).<\/p>\n\n<p>I could do this manually each time or I could automate it in a <code>run<\/code> command. :)<\/p>\n\n<p>Here's the function that I came up with:<\/p>\n\n<pre><code class=\"bash\">function drupal:set-urls-for-worktree {\n # Set the site URLs based on the current Git worktree name.\n local worktree_name=\"$(basename $PWD)\"\n\n local cy_url=\"cy-projectname-${worktree_name}.docker.localhost\"\n local en_url=\"projectname-${worktree_name}.docker.localhost\"\n\n # Update the URLs.\n drush config:set language.negotiation url.domains.cy -y $cy_url\n drush config:set language.negotiation url.domains.en -y $en_url\n\n # Display the domains configuration to ensure that they were set correctly.\n drush config:get language.negotiation url.domains\n}\n<\/code><\/pre>\n\n<p>It builds the worktree URL for each language based on the directory name, executes the configuration change, and finally displays the updated configuration so I can confirm that it's been set correctly.<\/p>\n\n<p>This is a good example of why I like using <code>run<\/code> files and how I use them to automate and simplify parts of my workflow.<\/p>\n\n ",
"format":"full_html",
"processed":"\n <p>Here's another <code>run<\/code> file example, this time relating to Git worktrees...<\/p>\n\n<p>One project that I work on is a multilingual Drupal application that needs to work in both English and Welsh. As I'm cloning a fresh version today, I'm doing it as a bare repository so I can use worktrees.<\/p>\n\n<p>To work on it locally, just like in production, I need to use a different URL for each language so that Drupal can identify it and load the correct content and configuration.<\/p>\n\n<p>For fixed environments like production or staging, the URLs are set in configuration files, but for ad-hoc environments such as local worktrees, I thought that the best approach was to override them as needed per worktree using Drush (a Drupal CLI tool).<\/p>\n\n<p>I could do this manually each time or I could automate it in a <code>run<\/code> command. :)<\/p>\n\n<p>Here's the function that I came up with:<\/p>\n\n<pre><code class=\"bash\">function drupal:set-urls-for-worktree {\n # Set the site URLs based on the current Git worktree name.\n local worktree_name=\"$(basename $PWD)\"\n\n local cy_url=\"cy-projectname-${worktree_name}.docker.localhost\"\n local en_url=\"projectname-${worktree_name}.docker.localhost\"\n\n # Update the URLs.\n drush config:set language.negotiation url.domains.cy -y $cy_url\n drush config:set language.negotiation url.domains.en -y $en_url\n\n # Display the domains configuration to ensure that they were set correctly.\n drush config:get language.negotiation url.domains\n}\n<\/code><\/pre>\n\n<p>It builds the worktree URL for each language based on the directory name, executes the configuration change, and finally displays the updated configuration so I can confirm that it's been set correctly.<\/p>\n\n<p>This is a good example of why I like using <code>run<\/code> files and how I use them to automate and simplify parts of my workflow.<\/p>\n\n ",