Skip to main content

Retention Rules Configuration

This page covers self-hosted configuration. To evaluate the feature, use it in the UI, or see supported rule JSON, start with the Retention Rules feature guide.

Default configuration​

Retention rules are enabled by default. Package and version targets are available; file targets remain disabled until you explicitly enable them.

Environment variableDefaultPurpose
ENABLE_RETENTION_RULEStrueEnables retention rules for the server.
RETENTION_RULES_ENABLE_FILE_RULESfalseAllows rules that delete individual files.
RETENTION_RULES_CONCURRENCY_LIMIT2Limits how many rules can run in parallel.
RETENTION_RULES_MAX_RULES_PER_REPOSITORY10Limits the number of rules in each repository.

See Server Environment Variables for the authoritative variable reference.

  1. Keep file rules disabled unless you have a specific, tested use case.
  2. Create a package-version rule and run it manually as a dry run.
  3. Review server load while running rules before increasing concurrency.
  4. Add a schedule only after the dry-run results are consistently correct.

File rules​

File retention rules can remove files that a package needs to work. Enabling the target does not make it safe for general cleanup; use it only when you understand the repository’s stored file layout.