Configure expiration for Signed Global IDs
mainSGIDs can be created with an expiration to limit access (e.g., for share links). You can specify a relative time with expires_in or an absolute time with expires_at.
Note: Expiring SGIDs are not idempotent because they encode the current timestamp; repeated calls to to_sgid will produce different strings.
Configuration
- Rails default: 1 month.
- Global default: Set via
SignedGlobalID.expires_in = 1.month. - Rails app-specific default: Set via
Rails.application.config.global_id.expires_in = 3.monthsin an initializer.
To create a permanent SGID that never expires, pass expires_in: nil.