diff --git a/.env.dist b/.env.dist index 7cdb85c292e..3e836bf2d13 100644 --- a/.env.dist +++ b/.env.dist @@ -59,3 +59,11 @@ JWT_PASSPHRASE=your_secret_passphrase # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages # MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages ###< symfony/messenger ### + +###> google cloud storage as filesystem ### +# GOOGLE_CLOUD_PROJECT_ID='' +# GOOGLE_CLOUD_KEY_FILE_PATH=%kernel.project_dir%/config/storage_keys/project-id-12345678.json +# GOOGLE_CLOUD_STORAGE_PREFIX='' +# GOOGLE_CLOUD_STORAGE_RESOURCE_BUCKET='' +# GOOGLE_CLOUD_STORAGE_RESOURCE_CACHE_BUCKET='' +###< google cloud storage as filesystem ### diff --git a/config/packages/oneup_flysystem.yaml b/config/packages/oneup_flysystem.yaml index b35965a6d02..5729be67208 100644 --- a/config/packages/oneup_flysystem.yaml +++ b/config/packages/oneup_flysystem.yaml @@ -14,6 +14,18 @@ oneup_flysystem: local: location: '%kernel.project_dir%/var/cache/resource' + resource_gcs_adapter: + googlecloudstorage: + client: 'Google\Cloud\Storage\StorageClient' + bucket: '%env(GOOGLE_CLOUD_STORAGE_RESOURCE_BUCKET)%' + prefix: '%env(GOOGLE_CLOUD_STORAGE_PREFIX)%' + + resource_cache_gcs_adapter: + googlecloudstorage: + client: 'Google\Cloud\Storage\StorageClient' + bucket: '%env(GOOGLE_CLOUD_STORAGE_RESOURCE_CACHE_BUCKET)%' + prefix: '%env(GOOGLE_CLOUD_STORAGE_PREFIX)%' + themes_adapter: local: location: '%kernel.project_dir%/var/themes' diff --git a/config/services.yaml b/config/services.yaml index c3930249dd8..db80bdbf479 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -111,6 +111,12 @@ services: - setMessengerBus: [ '@messenger.bus.default' ] - setValidator: [ '@validator' ] + Google\Cloud\Storage\StorageClient: + arguments: + $config: + projectId: '%env(GOOGLE_CLOUD_PROJECT_ID)%' + keyFilePath: '%env(resolve:GOOGLE_CLOUD_KEY_FILE_PATH)%' + cocur_slugify: lowercase: true diff --git a/config/storage_keys/README.md b/config/storage_keys/README.md new file mode 100644 index 00000000000..81e6e58a581 --- /dev/null +++ b/config/storage_keys/README.md @@ -0,0 +1,2 @@ +This directory is used to store the files needed for authentication of external file systems. +For example for the GOOGLE_CLOUD_KEY_FILE_PATH environment variable. \ No newline at end of file