Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

Managing environments

Environments

If your configuration file contains a key called "Environment", AppHarbor will replace its value:

Example:

<appSettings>
   <add key="Environment" value="Debug"/>
</appSettings>

When you push you code, we'll replace the value "Debug" depending on the current environment: While running unit tests "Environment" is set to "Test" and when your application is deployed and is running on a server, "Environment" equals your current environment name. The default environment name is "Release" and can be configured on the application Settings page.

Use this key to handle environment specific settings in your code.

Configuration Variables

confvars.png

You can set configuration variables for your application. When you add a configuration variable, we'll look for the key in any config file's AppSettings section and replace or add the value with the one defined on AppHarbor when your application is released.

Connectionstring replacement for Sequelizer: If you want connectionstrings from the Sequelizer add-on inserted into the connectionStrings element of your application configuraition (and not just not appSettings), please see the Using Sequelizer guide.

Configuration variables are a great to use one set of values when running your app locally and another set of values when your app is deployed to AppHarbor. It's also a great way to keep sensitive login information out of source control.

Configuration transformation

Configuration file transformation is supported on all .config files that have a corresponding .{environment}.config file (for instance, Web.Release.config). We'll run the configuration file transformation before deploying your code. We have built a transformation tester to help you debug your transforms.

Deploy from non-default branch

By default, AppHarbor will build the tips of all branches pushed. By default, only commits from the master branch (i.e. the one named default, master or trunk) is deployed. If you want AppHarbor to deploy from a branch with a different name (eg. production), you can specify a tracking branch in your application settings on the AppHarbor dashboard.

OutDir

When building your code, AppHarbor will override the value of the OutDir macro. This may cause problems if you have build events that rely on this value.

Commit Id

The build's commit id is injected into appSettings just like the configuration variables mentioned above. The key is appharbor.commit_id and the value is the commit id. This can be useful for invalidating cache etc.

Worker name

The name of a worker is injected into appSettings when your app is deployed. They key is appharbor.worker_name and contains values such as web.1, worker.1, web.2 or similar. This value also reflects the values you see in the build log when deploying an application.