Skip to main content

updateCvmEnvs

PATCH /cvms/{cvmId}/envs Updates the encrypted environment variables for a running CVM. This function uses a two-phase flow when the set of allowed env keys changes on a CVM with on-chain KMS:
  1. Phase 1: Call with encrypted_env and env_keys. If the env keys changed and the CVM uses on-chain KMS, the API returns precondition_required with a compose_hash.
  2. Register on-chain: Call addComposeHash to register the new compose hash on the blockchain.
  3. Phase 2: Retry the call with the original parameters plus compose_hash and transaction_hash.
Parameters: Returns: Union of two possible responses: Success (in_progress): Precondition required (precondition_required): Example — PHALA KMS (single phase):
Example — On-chain KMS (two phases):

safeUpdateCvmEnvs

Safe variant that returns a SafeResult instead of throwing on errors.