title: Set custom variable in capistrano 3
body: <p>I was using capistrano 2 with my php project, where I used to define custom variables like this:</p>
  
  <pre><code>set :app_environment, "test"
  </code></pre>
  
  <p>And then I accessed it in my deploy tasks, e.g.:</p>
  
  <pre><code>run "echo '#{app_environment}' &gt; #{releases_path}/#{release_name}/protected/config/mode.php"
  </code></pre>
  
  <p>Now in capistrano 3 I define this variable in my stage-specific config files. But I don't have them defined in my tasks:</p>
  
  <pre><code>undefined local variable or method `app_environment' for #&lt;SSHKit::Backend::Netssh:0x007f92323d6988&gt; config/deploy.rb:28:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Unfortunately there's not much documentation on the newest version of capistrano and I'm not quite familiar with ruby, so I don't see the way how to do that properly.</p>