Updated on 2026-09-24 GMT+08:00

Configuring Environment Variables

The Application-Plugin mode requires authentication before connecting to the encryption platform to retrieve encrypted fields and the corresponding keys; this authentication information is determined by the AK and SK. The Application-Plugin mode retrieves this value from environment variables. The configuration of these environment variables varies depending on the deployment scenario; you can select one from the following configurations.

Modify the Application Startup Script

If configuration isolation is required, different applications can use distinct environment variable values without interfering with each other; this approach can be referenced for configuring the AK and SK.

Operation method: Modify the application system's startup script.

#!/bin/bash
# start.sh-Startup script name
# Configure environment variables
export API_AK=<AK obtained from encryption platform>
export API_SK=<SK obtained from encryption platform>
# Launch App
java -jar your-app.jar

Edit ~/.profile

If you only need this to apply to the current user, you can refer to this approach.

Operation method: Edit the configuration file.

# 1. Edit configuration file
vi ~/.profile
# 2. Add the following content to the end of the document.
export API_AK=<AK obtained from encryption platform>
export API_SK=<SK obtained from encryption platform>
# 3. Save and Exit
# 4. Apply the configuration immediately
source ~/.profile
# 5. Verify whether the change has taken effect
echo $API_AK

Write to /etc/profile.d/*.sh

If you need to use a multi-user shared system or environment variables, we recommend modifying your setup according to the following method.

Operation method: Modify the system's automatic execution script.

# Create Configuration File
sudo vi /etc/profile.d/app.sh
# Add Content
export API_AK=<AK obtained from encryption platform>
export API_SK=<SK obtained from encryption platform>
#come into force
source /etc/profile