forked from LycheeOrg/Lychee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filesystems.php
164 lines (149 loc) · 5.17 KB
/
filesystems.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/**
* Given a .env config constant, retrieve the env value and remove any trailing /.
*
* @param string $cst constant to fetch
* @param string|null $default default value if does not exists
*
* @return string trimmed result
*/
if (!function_exists('renv')) {
function renv(string $cst, ?string $default = null): string
{
return rtrim(env($cst, $default) ?? '', '/');
}
}
/**
* Allow to conditionally append an env value.
*
* @param string $cst constant to fetch
*
* @return string '' or env value prefixed with '/'
*/
if (!function_exists('renv_cond')) {
function renv_cond(string $cst): string
{
return env($cst, '') === '' ? '' : ('/' . trim(env($cst), '/'));
}
}
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => 'images',
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
// Lychee uses the disk "images" to store the media files
'images' => [
'driver' => 'local',
'root' => env('LYCHEE_UPLOADS', public_path(env('LYCHEE_UPLOADS_DIR', 'uploads/'))),
'url' => env('LYCHEE_UPLOADS_URL', '') !== '' ? renv('LYCHEE_UPLOADS_URL')
: (renv('APP_URL', '') . renv_cond('APP_DIR') . '/' .
renv('LYCHEE_UPLOADS_DIR', 'uploads')),
'visibility' => env('LYCHEE_IMAGE_VISIBILITY', 'public'),
'directory_visibility' => env('LYCHEE_IMAGE_VISIBILITY', 'public'),
'permissions' => [
'file' => [
'world' => 00666,
'public' => 00664,
'private' => 00660,
],
'dir' => [
'world' => 02777,
'public' => 02775,
'private' => 02770,
],
],
],
// This is an example how the "images" disk can be hosted on an AWS S3
// ATTENTION: This is NOT supported yet!!!
// This is only a placeholder/reminder for the future
/*
'images' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => true,
],*/
// Lychee uses this disk to store the customized CSS file provided by the user
// ATTENTION: This disk MUST ALWAYS point to the local `./public/dist` directory.
// TODO: Maybe we should drop this Flysystem disk, because neither the driver nor the root must be changed and hence the whole point of using the Flysystem abstraction is gone.
'dist' => [
'driver' => 'local',
'root' => env('LYCHEE_DIST', public_path('dist/')),
'url' => env('LYCHEE_DIST_URL', 'dist/'),
'visibility' => 'public',
],
// Lychee uses this disk to create ephemeral, symbolic links to photos,
// if the feature is enabled.
// For this feature to work, the "images" disk must use the "local" driver.
// ATTENTION: This disk MUST ALWAYS use the "local" driver, because
// Flysystem does not support symbolic links.
'symbolic' => [
'driver' => 'local',
'root' => env('LYCHEE_SYM', public_path('sym')),
'url' => env('LYCHEE_SYM_URL', '') !== '' ? renv('LYCHEE_SYM_URL') :
(renv('APP_URL', 'http://localhost') . renv_cond('APP_DIR') . '/sym'),
'visibility' => 'public',
],
// We use this space to temporarily store images when uploading.
// Mostly chunks and incomplete images are placed here
'livewire-upload' => [
'driver' => 'local',
'root' => env('LYCHEE_TMP_UPLOAD', storage_path('livewire-tmp')),
'visibility' => 'private',
],
// We use this space to process the images,
'image-jobs' => [
'driver' => 'local',
'root' => env('LYCHEE_IMAGE_JOBS', storage_path('image-jobs')),
'visibility' => 'private',
],
// This is where we extract zip files before importing them.
'extract-jobs' => [
'driver' => 'local',
'root' => env('LYCHEE_EXTRACT_JOBS', storage_path('extract-jobs')),
'visibility' => 'private',
],
// For tests purposes
'tmp-for-tests' => [
'driver' => 'local',
'root' => storage_path('image-tmp/'),
'visibility' => 'private',
],
],
];