Managing Application Environment Variables
Environment variables are parameters set in the system or user applications. You can obtain the values of environment variables by calling APIs. During deployment, parameters are specified through environment variables instead of in the code, which makes the deployment flexible.
Environment variables added to an application are global environment variables and take effect for all components of the application.
For details about how to add environment variables to a specific component, see Setting Component Environment Variables.
Manually Adding an Application Environment Variable
- Log in to ServiceStage.
- Choose Application Management.
- Click the target application. The Overview page is displayed.
- In the navigation pane on the left, click Environment Variables.
- Select a created environment from the drop-down list.
- Click Add Environment Variable and set Name and Variable/Variable Reference.
Where,
- Name is the name of an application environment variable and must be unique.
- Variable/Variable Reference is the value of the application environment variable.
For example, set Variable Name to User and Variable/Variable reference to admin. That is, when the program code reads the User environment variable, admin is obtained. For example, you can start subprocesses as the admin user and read files as the admin user. The actual execution effect depends on the code.
- Click Submit.
Importing the Application Environment Variable File
- Log in to ServiceStage.
- Choose Application Management.
- Click the target application. The Overview page is displayed.
- In the navigation pane on the left, click Environment Variables.
- Select a created environment from the Environment drop-down list.
- Click Import and select the environment variable file created locally.
The file to be imported must be a key-value pair mapping file in JSON or YAML format and in character string format. For example:
{"key1": "value1", "key2": "value2"}
Where,
- key1 and key2 are the names of application environment variables and must be unique.
- value1 and value2 are the values of application environment variables.
- Click Submit.
Editing an Application Environment Variable
- Log in to ServiceStage.
- Choose Application Management.
- Click the target application. The Overview page is displayed.
- In the navigation pane on the left, click Environment Variables.
- Select a created environment from the Environment drop-down list.
- Select the variable to be edited and click Edit in the Operation column.
- Reset Variable Name and Variable/Variable Reference.
- Variable Name is the name of an application environment variable and must be unique.
- Variable/Variable Reference is the value of the application environment variable.
- Click Submit.
Figure 1 Editing an application environment variable
Deleting an Application Environment Variable
- Log in to ServiceStage.
- Choose Application Management.
- Click the target application. The Overview page is displayed.
- In the navigation pane on the left, click Environment Variables.
- Select a created environment from the Environment drop-down list.
- To delete a single application environment variable, select the target variable and click Delete in the Operation column.
Figure 2 Deleting a single application environment variable
- To delete application environment variables in batches, select the target variables and click Bulk Delete.
Figure 3 Deleting application environment variables in batches
- To delete a single application environment variable, select the target variable and click Delete in the Operation column.
- In the displayed dialog box, click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot