-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide env variable for configuring custom s3 hosts
- Loading branch information
1 parent
267eec0
commit 5894ccc
Showing
3 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,13 @@ | |
*/ | ||
function s3Endpoint($disk = 'libraries') | ||
{ | ||
// if a custom s3 endpoint is configured explicitly, return it | ||
$customEndpoint = config("filesystems.disks.{$disk}.endpoint"); | ||
|
||
if ($customEndpoint) { | ||
return $customEndpoint; | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kirkbushell
|
||
|
||
$scheme = config("filesystems.disks.{$disk}.use_https") ? 'https://' : ''; | ||
return $scheme . config("filesystems.disks.{$disk}.bucket") . '.' . Storage::disk($disk)->getAdapter()->getClient()->getEndpoint()->getHost(); | ||
} | ||
|
This change breaks compatibility for other s3 compliant storage:
Digital Ocean spaces for example expects the endpoint to be defined as https://{region}.digitaloceanspaces.com, without the bucket name in the endpoint.
When determining the asset path the bucketname should be interpolated into the endpoint url as it is below.
PR #703