Last updated on 15th September 2026

Config Files

Config files in DeployHQ are files that you want to upload during a deployment, but not keep in your repository. This is particularly useful for configuration files that might contain sensitive data such as a database config file.

To add a config file, head to your project's Settings dropdown, then the Config Files option. Click to add a new config file, entering the full path to it as the name, then any data you need it to contain.

You can also add an optional description to help you identify the purpose of the config file, and select a language for syntax highlighting to make editing easier.

Config file editor

Then, you can choose where the config file will be used by configuring the following settings:

Use this file with the Build Pipeline? - Enable this to make the config file available during build commands. This is useful for configuration files needed during the build process.

Upload this file to all current and future servers or server groups? - Choose whether to upload the config file to all servers automatically, or select specific servers and server groups. These options can be individually enabled or disabled as required.

Config file targets

If you wish to deploy the file to certain servers, uncheck the Upload this file to all current and future servers? option and you'll be able to choose specific servers that have been configured in your project. As a result, you can set up multiple configuration files for each environment type (development, staging, production etc) and only deploy them where you need to. You can also select Server Groups.

config files can be assigned to servers and server groups

Environment-specific files in the build pipeline

If your build commands need to read a config file, and that file's contents differ per environment, you can combine the two settings above: create one config file per environment, give them all the same path, enable Use this file with the Build Pipeline? on each, and target each one at the relevant server or server group.

Your build then receives the variant belonging to the server you are deploying to. Deploy to staging and your build commands read the staging file; deploy to production and they read the production one. This is useful when a build step needs to generate or merge configuration using environment-specific values rather than having those values arrive on the server afterwards.

Where several config files share a path, the one sent to the build server is chosen as follows:

  • A file targeted at a server in the current deployment is preferred over one that is not.
  • Between those, a file targeted at a specific server takes precedence over one targeted at a server group, which in turn takes precedence over a file set to all servers.

The build pipeline runs once per deployment, before any files are transferred to your servers. If a single deployment covers two servers that each need a different variant of the same file, only one of them can be used for that build, and the deployment log will tell you which one was chosen. Deploy those environments separately when your build depends on the difference.

Note that values which vary per server, such as server-specific variables, are not substituted in the copy sent to the build server, so keep those values literal in files used this way.

Environment Variables

If you find you need to set project wide environment variables to be used with SSH commands before a deployment, therefore before the config file would've been uploaded, another option would be to add the variables to the deployment user’s .bashrc, file directly on your server.

It's worth noting, environment variables are server specific, and cannot be used with server groups. For account-wide variables shared across projects, see global environment variables.

Global Config Files

If you need the same config file across multiple projects, DeployHQ supports global config files — account-level templates that automatically sync to all linked projects, with API endpoints for programmatic management.

Config files deployments

If you wish to deploy your config files but do not need to perform any other changes on your server, DeployHQ also offers the Config file deployments option for these cases.

Config file deployment button

You just need to set up your config files beforehand, and perform a config file deployment to the servers of your choice. More details on this process can be found here.