We’ve entered the dreaded “it works on my computer” zone with our HTTPS setup. Let’s take things further by automating the manual steps so anyone on the team can set it up effortlessly.
Rails includes a handy bin/setup script for first-time project setup. We’ll extend it to handle the mkcert setup for HTTPS automatically:
# bin/setup
FileUtils.chdir APP_ROOT do
# …
if `which mkcert`.strip.empty?
puts "Please install mkcert (e.g., brew install mkcert)"
exit 1
end
system "mkcert localhost"
# …
end
This script ensures that mkcert is installed and then creates the necessary certificates for local SSL. No more manual setup!
Tomorrow, we’ll tackle the next challenge: making sure mobile devices can connect properly to the development server.