diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index 5a1c844a2f..d54eed1467 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "os" "strings" "time" @@ -155,7 +156,8 @@ func (d *Datastore) SaveHost(ctx context.Context, host *fleet.Host) error { return errors.Wrap(err, "failed to get app config to see if we need to update host users and inventory") } - if host.HostSoftware.Modified && ac.HostSettings.EnableSoftwareInventory && len(host.HostSoftware.Software) > 0 { + softwareInventoryEnabled := os.Getenv("FLEET_BETA_SOFTWARE_INVENTORY") != "" || ac.HostSettings.EnableSoftwareInventory + if host.HostSoftware.Modified && softwareInventoryEnabled && len(host.HostSoftware.Software) > 0 { if err := saveHostSoftwareDB(ctx, tx, host); err != nil { return errors.Wrap(err, "failed to save host software") }