Set Passwords using Environment Variables or System Properties¶
The instructions on this page explain how you can set the passwords of system users, keystores, and truststores, etc. using system properties and environment variable, rather than hard coding them in the configuration file itself.
Set passwords using environment variables¶
-
Set the password to an environment variable.
-
Open
<APIM_HOME>/repository/deployment.toml
file and refer the password value in the configuration using the$env{<environment_variable_name>}
placeholder.[super_admin] username="admin" password="$env{<environment_variable_name>}"
[super_admin] username="admin" password="$env{ADMIN_PASSWORD}"
-
Start the server to apply the changes.
- On Linux:
./api-manager.sh
- On Windows:
./api-manager.bat
- On Linux:
Set passwords using system properties¶
-
Open the
<APIM_HOME>/repository/deployment.toml
file and refer the required password value in the configuration using the$sys{system.property}
placeholder.[super_admin] username="admin" password="$sys{system.property}"
[super_admin] username="admin" password="$sys{admin.password}"
-
Pass the above-configured system property to the runtime by using one of the following options.
Let's use
admin.password
here as a sample system property.-
During the server startup time
- On Linux:
./api-manager.sh -Dadmin.password=admin
- On Windows:
./api-manager.bat -Dadmin.password=admin
- On Linux:
-
Configure the system property in the
<APIM_HOME>/bin/api-manager.sh
file.-Dadmin.password=admin \
-