Updated on 2025-08-13 GMT+08:00

Modifying a Configuration File

This action aims to modify the specified content in a file by identifying specific identifiers. The following table describes the configuration parameters.

Table 1 Parameters

Parameter

Description

Action Name

Custom action name. Enter 1 to 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./()

Environment

Deployment object. Select an environment whose resource type is host cluster.

Absolute Path

Absolute path of the configuration file to modify.

  • Modify a single file, for example, /usr/local/server.config.
  • Modify multiple files, for example, /usr/local/server.config;/usr/local/a.txt.
  • The wildcard character (*) can be used, for example, /usr/local/*.config. However, you cannot separate multiple wildcards using semicolons (;), for example, /usr/local/*.config;/usr/local/*.txt.

Prefix and Suffix

Parameter reference flag. If no prefix or suffix is matched, the configuration file remains unchanged and no error is reported in logs.

Action Control

You can configure whether to enable the settings.

  • Keep running on failure: Continue the task even if this action fails.
  • Execute this action with the sudo permission: Use the sudo permission to deploy this action.

Configuration Example

To change the service port, perform the following steps:

  1. Open the configuration file and view the content.

    Figure 1 Checking the configuration file

  2. Change the prefix and suffix. For example, change the prefix to ${ and the suffix to }.
  3. On the Parameters tab, set Name and Default Value.

  4. Save the configuration and deploy the application.
  5. After the deployment is complete, open the configuration file again.

    The value of ${port} is changed to 8080.
    Figure 2 Checking the configuration file

If you encounter any problems during deployment, see Modifying a Configuration File.