diff --git a/Vagrantfile b/Vagrantfile index 4997060552..29803603a0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,7 +29,7 @@ Vagrant.configure('2') do |config| config.vm.box = box config.vm.box_version = vconfig.fetch('vagrant_box_version') config.ssh.forward_agent = true - config.vm.post_up_message = post_up_message + config.vm.post_up_message = post_up_message(trellis_config) # Fix for: "stdin: is not a tty" # https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042 diff --git a/lib/trellis/vagrant.rb b/lib/trellis/vagrant.rb index ef3c6bd13a..accbc6ceb9 100644 --- a/lib/trellis/vagrant.rb +++ b/lib/trellis/vagrant.rb @@ -72,7 +72,7 @@ def mount_options(mount_type, dmode:, fmode:) end end -def post_up_message +def post_up_message(trellis_config) msg = 'Your Trellis Vagrant box is ready to use!' msg << "\n* Composer and WP-CLI commands need to be run on the virtual machine" msg << "\n for any post-provision modifications." @@ -80,6 +80,21 @@ def post_up_message msg << "\n* Then navigate to your WordPress sites at `/srv/www`" msg << "\n or to your Trellis files at `#{ANSIBLE_PATH_ON_VM}`." + if trellis_config.wordpress_sites.any? + msg << "\n\n\e[35m🚀 Development URLs: \e[0m" + trellis_config.wordpress_sites.each do |site_name, site| + site_url = site['site_hosts'].first + site_url = site_url.is_a?(Hash) ? site_url['canonical'] : site_url + site_url = site.dig('ssl', 'enabled') ? "https://#{site_url}" : "http://#{site_url}" + msg << "\n + 🌱 \e[37mName:\e[33m #{site_name}\e[0m + ├── \e[37m🔗 URL:\e[33m #{site_url}\e[0m + ├── \e[37m🔧 Admin:\e[33m #{site_url}/wp-admin\e[0m + └── \e[37m📩 Mailpit:\e[33m #{site_url}:8025\e[0m + " + end + end + msg end