Skip to content

Commit 8455c26

Browse files
committed
Internal: Add basic config to use Azure Storage as a filesystem
1 parent 964660e commit 8455c26

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

.env.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ PACKAGER='{{PACKAGER}}'
8787
DEFAULT_TEMPLATE='{{DEFAULT_TEMPLATE}}'
8888
ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}'
8989

90+
###> azure blob storage as filesystem ###
91+
# AZURE_STORAGE_CONNECTION_STRING='DefaultEndpointsProtocol=https;AccountName=azurechamilo;AccountKey=ACCOUNTKEY==;EndpointSuffix=core.windows.net'
92+
# AZURE_STORAGE_ASSET_CONTAINER='asset-container-name'
93+
# AZURE_STORAGE_ASSET_PREFIX='optional/prefix'
94+
# AZURE_STORAGE_ASSET_CACHE_CONTAINER='asset-cache-container-name'
95+
# AZURE_STORAGE_ASSET_CACHE_PREFIX='optional/prefix'
96+
# AZURE_STORAGE_RESOURCE_CONTAINER='resources-container-name'
97+
# AZURE_STORAGE_RESOURCE_PREFIX='optional/prefix'
98+
# AZURE_STORAGE_RESOURCE_CACHE_CONTAINER='resources-cache-container-name'
99+
# AZURE_STORAGE_RESOURCE_CACHE_PREFIX='optional/prefix'
100+
# AZURE_STORAGE_THEMES_CONTAINER='themes-container-name'
101+
# AZURE_STORAGE_THEMES_PREFIX='optional/prefix'
102+
###< azure blob storage as filesystem ###
90103
###> google cloud storage as filesystem ###
91104
# GOOGLE_STORAGE_CLOUD_PROJECT_ID=''
92105
# GOOGLE_STORAGE_KEY_FILE_PATH=%kernel.project_dir%/config/storage_keys/project-id-12345678.json

config/packages/oneup_flysystem.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ oneup_flysystem:
77
local:
88
location: '%kernel.project_dir%/var/cache/assets'
99

10+
asset_azure_adapter:
11+
azureblob:
12+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
13+
container: '%env(AZURE_STORAGE_ASSET_CONTAINER)%'
14+
prefix: '%env(AZURE_STORAGE_ASSET_PREFIX)%'
15+
16+
asset_cache_azure_adapter:
17+
azureblob:
18+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
19+
container: '%env(AZURE_STORAGE_ASSET_CACHE_CONTAINER)%'
20+
prefix: '%env(AZURE_STORAGE_ASSET_CACHE_PREFIX)%'
21+
1022
asset_google_adapter:
1123
googlecloudstorage:
1224
client: 'Google\Cloud\Storage\StorageClient'
@@ -26,6 +38,18 @@ oneup_flysystem:
2638
local:
2739
location: '%kernel.project_dir%/var/cache/resource'
2840

41+
resource_azure_adapter:
42+
azureblob:
43+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
44+
container: '%env(AZURE_STORAGE_RESOURCE_CONTAINER)%'
45+
prefix: '%env(AZURE_STORAGE_RESOURCE_PREFIX)%'
46+
47+
resource_cache_azure_adapter:
48+
azureblob:
49+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
50+
container: '%env(AZURE_STORAGE_RESOURCE_CACHE_CONTAINER)%'
51+
prefix: '%env(AZURE_STORAGE_RESOURCE_CACHE_PREFIX)%'
52+
2953
resource_google_adapter:
3054
googlecloudstorage:
3155
client: 'Google\Cloud\Storage\StorageClient'
@@ -42,6 +66,12 @@ oneup_flysystem:
4266
local:
4367
location: '%kernel.project_dir%/var/themes'
4468

69+
themes_azure_adapter:
70+
azureblob:
71+
client: 'MicrosoftAzure\Storage\Blob\BlobRestProxy'
72+
container: '%env(AZURE_STORAGE_THEMES_CONTAINER)%'
73+
prefix: '%env(AZURE_STORAGE_THEMES_PREFIX)%'
74+
4575
themes_google_adapter:
4676
googlecloudstorage:
4777
client: 'Google\Cloud\Storage\StorageClient'

config/services.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ services:
139139
projectId: '%env(GOOGLE_STORAGE_CLOUD_PROJECT_ID)%'
140140
keyFilePath: '%env(resolve:GOOGLE_STORAGE_KEY_FILE_PATH)%'
141141

142+
MicrosoftAzure\Storage\Blob\BlobRestProxy:
143+
factory: ['MicrosoftAzure\Storage\Blob\BlobRestProxy', 'createBlobService']
144+
arguments:
145+
- '%env(AZURE_STORAGE_CONNECTION_STRING)%'
146+
142147
cocur_slugify:
143148
lowercase: true
144149

0 commit comments

Comments
 (0)