Skip to content

Commit

Permalink
Add basic config to use Google Cloud Storage as file system
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Aug 12, 2024
1 parent b573f2c commit c23c159
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
12 changes: 12 additions & 0 deletions config/packages/oneup_flysystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 6 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions config/storage_keys/README.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit c23c159

Please sign in to comment.