feat(tfstated): allow configuration of version history limit via environment variable

This commit is contained in:
Julien Dessaux 2024-10-18 00:01:50 +02:00
parent 4c2032e1f0
commit 1ebf0341dd
Signed by: adyxax
GPG key ID: F92E51B86E07177E
5 changed files with 43 additions and 9 deletions

View file

@ -102,7 +102,8 @@ func (db *DB) SetState(name string, data []byte, lockID string) (bool, error) {
JOIN states ON states.id = versions.state_id
WHERE states.name = :name
ORDER BY versions.id DESC
LIMIT 64));`,
LIMIT :limit));`,
sql.Named("limit", db.versionsHistoryLimit),
sql.Named("name", name),
)
if err != nil {