Skip to content

Conversation

mikeniko
Copy link

@mikeniko mikeniko commented May 5, 2025

Motivation

The current implementation does not allow setting both the view count and expiration at the same time. Additionally, when persistence is required, keys without expiration can flood the database. According to our requirements, we need long-living secrets, but we must ensure that they expire after a specified period.

Solution

This change introduces three new environment variables:

  • DEFAULT_EXPIRE
  • DEFAULT_VIEWS
  • DISABLE_MODE_SWITCH

The main goal is to maintain compatibility with the current implementation in the default configuration.

Key Changes

  • The new implementation always sets an expiration for any secret — there is no option for infinite lifespan. This is the only "breaking" change.
  • DEFAULT_EXPIRE: Used when expiration is not explicitly specified. Defaults to 60 minutes if not provided.
  • DEFAULT_VIEWS: Applied when the advanced mode is disabled or when expiration is selected in advanced mode with the mode switch enabled (keeping its default value to 0 makes views amount unlimited as in the original implementation).
  • DISABLE_MODE_SWITCH: Disables the mode switch in the advanced section, allowing users to specify both a view limit and expiration time.

Summary

This update improves secret management by enforcing expiration, reducing database clutter, and allowing better control over secret lifecycle through configurable defaults. Backward compatibility is preserved for default usage, with the only exception being that secrets can no longer have infinite lifespans.

@cupcakearmy
Copy link
Owner

@cupcakearmy cupcakearmy added the enhancement New feature or request label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants