Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect baseUri for static Targets #36

Open
paavo opened this issue May 24, 2022 · 3 comments
Open

Respect baseUri for static Targets #36

paavo opened this issue May 24, 2022 · 3 comments
Assignees

Comments

@paavo
Copy link
Contributor

paavo commented May 24, 2022

it looks like baseUri is ignored when using a GcsTarget as static target @kdambekalns

Neos:
  Flow:
    resource:
      targets:
        googleStaticResourcesTarget:
          target: 'Flownative\Google\CloudStorage\GcsTarget'
          targetOptions:
            bucket: '%env:CLOUDSTORAGE_S3_BUCKET%'
            keyPrefix: 'statictarget/'
            baseUri: '%env:CLOUDSTORAGE_S3_PUBLICURL%'
            
Neos:
  Flow:
    resource:
      collections:
        static:
          target: 'googleStaticResourcesTarget'
@paavo paavo closed this as completed May 24, 2022
@paavo
Copy link
Contributor Author

paavo commented May 24, 2022

persistentResourceUris.pattern could help 🤔

@paavo paavo reopened this May 24, 2022
@paavo
Copy link
Contributor Author

paavo commented May 24, 2022

Looks like persistentResourceUris pattern is ignored too 🙈

            persistentResourceUris:
              pattern: '{baseUri}{sha1}/{filename}' 

@kdambekalns kdambekalns self-assigned this May 24, 2022
@kdambekalns
Copy link
Member

Yes, static resource URIs are built like this: https://github.com/flownative/flow-google-cloudstorage/blob/5.3.1/Classes/GcsTarget.php#L434-L438

Slightly simpler compared to persistent URIs: https://github.com/flownative/flow-google-cloudstorage/blob/5.3.1/Classes/GcsTarget.php#L539-L578

Why is this usually not bad? Your webserver should be very fast when delivering static files. So the response time largely depends on how good the network connection is. In that case using GCS with a CDN can be faster, if your distance to the CDN edge location makes a difference. Without a CDN GCS is usually slower for static resources.

But of course the hardcoded

'https://storage.googleapis.com/' . $this->bucketName . '/' . $this->keyPrefix . $relativePathAndFilename;

could be a bit more flexible…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants