Skip to content

Commit cfc6388

Browse files
committed
Add basic config to use Google Cloud Storage as file system
1 parent 680495d commit cfc6388

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
@@ -73,3 +73,11 @@ THEME_FALLBACK='{{THEME_FALLBACK}}'
7373
PACKAGER='{{PACKAGER}}'
7474
DEFAULT_TEMPLATE='{{DEFAULT_TEMPLATE}}'
7575
ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}'
76+
77+
###> google cloud storage as filesystem ###
78+
# GOOGLE_CLOUD_PROJECT_ID=''
79+
# GOOGLE_CLOUD_KEY_FILE_PATH=%kernel.project_dir%/config/storage_keys/project-id-12345678.json
80+
# GOOGLE_CLOUD_STORAGE_PREFIX=''
81+
# GOOGLE_CLOUD_STORAGE_RESOURCE_BUCKET=''
82+
# GOOGLE_CLOUD_STORAGE_RESOURCE_CACHE_BUCKET=''
83+
###< 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
@@ -129,6 +129,12 @@ services:
129129
- setValidator: [ '@validator' ]
130130
- setSessionFactory: [ '@session.factory' ]
131131

132+
Google\Cloud\Storage\StorageClient:
133+
arguments:
134+
$config:
135+
projectId: '%env(GOOGLE_CLOUD_PROJECT_ID)%'
136+
keyFilePath: '%env(resolve:GOOGLE_CLOUD_KEY_FILE_PATH)%'
137+
132138
cocur_slugify:
133139
lowercase: true
134140

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)