fleet/server/datastore/s3/software_title_icon.go
Lucas Manuel Rodriguez 9297acdf72
Fix GCS for remaining features that use S3 (#32743)
For #32571.

Original PR from the community:
https://github.com/fleetdm/fleet/pull/32573.

Changes on this PR:
- Only setting the checksum algorithm when using GCS as backend (to not
break other S3 backends).
- Changes for carves, bootstrap packages, and software icons which also
use S3.

## Testing

- [X] QA'd all new/changed functionality manually

```sh
FLEET_S3_SOFTWARE_INSTALLERS_BUCKET=some-software-installers-bucket \
FLEET_S3_SOFTWARE_INSTALLERS_ACCESS_KEY_ID=... \
FLEET_S3_SOFTWARE_INSTALLERS_SECRET_ACCESS_KEY=... \
FLEET_S3_SOFTWARE_INSTALLERS_ENDPOINT_URL=https://storage.googleapis.com \
FLEET_S3_SOFTWARE_INSTALLERS_REGION=us \
FLEET_S3_SOFTWARE_INSTALLERS_FORCE_S3_PATH_STYLE=true \
FLEET_S3_CARVES_BUCKET=some-carves-bucket \
FLEET_S3_CARVES_ACCESS_KEY_ID=... \
FLEET_S3_CARVES_SECRET_ACCESS_KEY=... \
FLEET_S3_CARVES_ENDPOINT_URL=https://storage.googleapis.com \
FLEET_S3_CARVES_REGION=us \
FLEET_S3_CARVES_FORCE_S3_PATH_STYLE=true \
./build/fleet serve --dev --dev_license --logging_debug 2>&1 | tee ~/fleet.txt
```
2025-09-09 11:22:04 -03:00

26 lines
601 B
Go

package s3
import (
"github.com/fleetdm/fleet/v4/server/config"
)
type SoftwareTitleIconStore struct {
*commonFileStore
}
func NewSoftwareTitleIconStore(config config.S3Config) (*SoftwareTitleIconStore, error) {
// software title icons use the same S3 config as software installers
s3store, err := newS3Store(config.SoftwareInstallersToInternalCfg())
if err != nil {
return nil, err
}
return &SoftwareTitleIconStore{
&commonFileStore{
s3store: s3store,
pathPrefix: "software-title-icons",
fileLabel: "software title icon",
gcs: isGCS(config.EndpointURL),
},
}, nil
}