Forwardfiles: Set Your Forward Options Automagically

January 22nd, 2013

We just rolled out a new version of the Forward client, with a new feature that we’re pretty excited about: Forwardfiles.

When you’re using Forward with several projects, it can become tedious remembering which command-line options to use for each project. A Forwardfile lets you set options within a flatfile in the project itself. You can even track it in version control if you want (but be careful not to track authentication credentials).

Most of the options that you would specify via command line switches are supported, and map one-to-one to the Forwardfile. Also it’s just a YAML file, so you don’t need to learn any funky new syntax.

A few examples:

# Set the port to forward
port: 3000

# Set the host/vhost to forward
host: example.dev

# Set a static subdomain prefix to use
# (e.g. myapp-yourcompany.fwd.wf)
subdomain_prefix: myapp

# Set a CNAME to use
cname: foo.example.com

# Set a username and password
username: foo
password: bar

# Disable auth on this tunnel (useful if you have 
# “require authentication" enabled in your preferences)
no_auth: true

So how do you use them? First update to the latest version of the Forward gem. Then just create a Forwardfile at the top level of your project and specify the options you want to set as shown above. Now cd into your project directory, and run forward. Depending on how many options you’ve set in your Forwardfile, you may not have to pass any option to the forward command at all.

We use Forward a lot, and know that sometimes it gets a little crazy when you’re constantly jumping between multiple projects. We think Forwardfiles are a good solution to the problem and we hope you find them useful.