Skip to content

Commit c23c159

Browse files
committed
Add basic config to use Google Cloud Storage as file system
1 parent b573f2c commit c23c159

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

.env.dist

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ JWT_PASSPHRASE=your_secret_passphrase
5959
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
6060
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
6161
###< symfony/messenger ###
62+
63+
###> google cloud storage as filesystem ###
64+
# GOOGLE_CLOUD_PROJECT_ID=''
65+
# GOOGLE_CLOUD_KEY_FILE_PATH=%kernel.project_dir%/config/storage_keys/project-id-12345678.json
66+
# GOOGLE_CLOUD_STORAGE_PREFIX=''
67+
# GOOGLE_CLOUD_STORAGE_RESOURCE_BUCKET=''
68+
# GOOGLE_CLOUD_STORAGE_RESOURCE_CACHE_BUCKET=''
69+
###< google cloud storage as filesystem ###

config/packages/oneup_flysystem.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ oneup_flysystem:
1414
local:
1515
location: '%kernel.project_dir%/var/cache/resource'
1616

17+
resource_gcs_adapter:
18+
googlecloudstorage:
19+
client: 'Google\Cloud\Storage\StorageClient'
20+
bucket: '%env(GOOGLE_CLOUD_STORAGE_RESOURCE_BUCKET)%'
21+
prefix: '%env(GOOGLE_CLOUD_STORAGE_PREFIX)%'
22+
23+
resource_cache_gcs_adapter:
24+
googlecloudstorage:
25+
client: 'Google\Cloud\Storage\StorageClient'
26+
bucket: '%env(GOOGLE_CLOUD_STORAGE_RESOURCE_CACHE_BUCKET)%'
27+
prefix: '%env(GOOGLE_CLOUD_STORAGE_PREFIX)%'
28+
1729
themes_adapter:
1830
local:
1931
location: '%kernel.project_dir%/var/themes'

config/services.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ services:
111111
- setMessengerBus: [ '@messenger.bus.default' ]
112112
- setValidator: [ '@validator' ]
113113

114+
Google\Cloud\Storage\StorageClient:
115+
arguments:
116+
$config:
117+
projectId: '%env(GOOGLE_CLOUD_PROJECT_ID)%'
118+
keyFilePath: '%env(resolve:GOOGLE_CLOUD_KEY_FILE_PATH)%'
119+
114120
cocur_slugify:
115121
lowercase: true
116122

config/storage_keys/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This directory is used to store the files needed for authentication of external file systems.
2+
For example for the GOOGLE_CLOUD_KEY_FILE_PATH environment variable.

0 commit comments

Comments
 (0)