Add Service Config Files

Updated 4 weeks ago by Chakravarthy Tenneti

On the Services page, as a part of managing the Services you created, you can add Service Config Files that can be used throughout your configuration settings.

For information about how configuration files are used in a Kubernetes deployment, see Kubernetes Deployments Overview.

In this topic:

Before You Begin

  • Read the Create an Application topic to get an overview of how Harness organizes Services.
  • Read the Add a Service topic to understand the process to add a Service to an Application.
  • Read Configuration as Code to see how you can quickly configure your Harness Service using your existing YAML in Git.

Review: Required Permissions

Make sure you have the update permission on the Service before you try to add the Service Config File. See Managing Users and Groups (RBAC) for more information about assigning permissions.

Step 1: Add Config Files

Files added in the Config Files section are referenced using the configFile.getAsString("fileName") Harness functor:

  • ${configFile.getAsString("fileName")} – Unencrypted text file.
  • ${configFile.getAsBase64("fileName")} – Encrypted text file.

For example, let's add a Config Files file named config-file-example.txt.

You would reference this file in a Workflow that uses this Service like this:

${configFile.getAsString("config-file-example.txt")}

For example, here is an a config file named example.txt containing the string This is a config file from the Service added to a Service and then referenced in the Workflow that uses the Service. Finally, in the completed Workflow deployment, you can see the contents of the file output.

Step 2: Use Copy Configs Command

In most cases, use the Copy Configs command to copy the Config Files to your target hosts. You can add Copy Configs from the command menu in the Service:

In Copy Configs, you can change the location on the target host(s) where the files are added:

By default, it uses the Application Defaults path $WINGS_RUNTIME_PATH.

When the Workflow using this Service is deployed, the Copy Configs command copies the Service Config File to the target host:


How did we do?