Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support S3 compatible storage services #56

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/Http/Controllers/V1/Admin/Settings/DiskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ public function show($disk)

break;

case 's3compat':
$diskData = [
'endpoint' => '',
'key' => '',
'secret' => '',
'region' => '',
'bucket' => '',
'root' => '',
];

case 'doSpaces':
$diskData = [
'key' => '',
Expand Down Expand Up @@ -160,6 +170,10 @@ public function getDiskDrivers()
'name' => 'Amazon S3',
'value' => 's3',
],
[
'name' => 'S3 Compatible Storage',
'value' => 's3compat',
],
[
'name' => 'Digital Ocean Spaces',
'value' => 'doSpaces',
Expand Down
10 changes: 10 additions & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
'root' => env('AWS_ROOT'),
],

's3compat' => [
'driver' => 's3',
'endpoint' => env('S3_COMPAT_ENDPOINT'),
'use_path_style_endpoint' => true,
'key' => env('S3_COMPAT_KEY'),
'secret' => env('S3_COMPAT_SECRET'),
'region' => env('S3_COMPAT_REGION'),
'bucket' => env('S3_COMPAT_BUCKET'),
],

'media' => [
'driver' => 'local',
'root' => public_path('media'),
Expand Down
6 changes: 6 additions & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,12 @@
"aws_region": "AWS-Region",
"aws_bucket": "AWS Bucket",
"aws_root": "AWS-Pfad",
"s3_endpoint": "S3 Endpunkt",
"s3_key": "S3 Schlüssel",
"s3_secret": "S3 Geheimnis",
"s3_region": "S3 Region",
"s3_bucket": "S3 Bucket",
"s3_root": "S3 Pfad",
"do_spaces_type": "Do Spaces-Typ",
"do_spaces_key": "Do Spaces Key",
"do_spaces_secret": "Do Spaces Secret",
Expand Down
6 changes: 6 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,12 @@
"aws_region": "AWS Region",
"aws_bucket": "AWS Bucket",
"aws_root": "AWS Root",
"s3_endpoint": "S3 Endpoint",
"s3_key": "S3 Key",
"s3_secret": "S3 Secret",
"s3_region": "S3 Region",
"s3_bucket": "S3 Bucket",
"s3_root": "S3 Root",
"do_spaces_type": "Do Spaces type",
"do_spaces_key": "Do Spaces key",
"do_spaces_secret": "Do Spaces Secret",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
>
<template #default="slotProps">
<div
class="
z-0
flex
justify-end
p-4
border-t border-solid border-gray-light
"
class="z-0 flex justify-end p-4 border-t border-solid border-gray-light"
>
<BaseButton
class="mr-3 text-sm"
Expand Down Expand Up @@ -66,12 +60,14 @@ import { computed, ref, watchEffect } from 'vue'
import Dropbox from '@/scripts/admin/components/modal-components/disks/DropboxDisk.vue'
import Local from '@/scripts/admin/components/modal-components/disks/LocalDisk.vue'
import S3 from '@/scripts/admin/components/modal-components/disks/S3Disk.vue'
import S3compat from '@/scripts/admin/components/modal-components/disks/S3CompatDisk.vue'
import DoSpaces from '@/scripts/admin/components/modal-components/disks/DoSpacesDisk.vue'
export default {
components: {
Dropbox,
Local,
S3,
S3compat,
DoSpaces,
},
setup() {
Expand Down Expand Up @@ -109,20 +105,28 @@ export default {
}

async function createNewDisk(data) {
Object.assign(diskStore.diskConfigData, data)
isLoading.value = true
try {
Object.assign(diskStore.diskConfigData, data)
isLoading.value = true

let formData = {
id: modalStore.id,
...data,
}
let formData = {
id: modalStore.id,
...data,
}

let response = null
const action = isEdit.value ? diskStore.updateDisk : diskStore.createDisk
response = await action(formData)
isLoading.value = false
modalStore.refreshData()
closeDiskModal()
let response = null
const action = isEdit.value
? diskStore.updateDisk
: diskStore.createDisk

response = await action(formData)
modalStore.refreshData()
closeDiskModal()
} catch (e) {
// error is handled by the disk store
} finally {
isLoading.value = false
}
}

function closeDiskModal() {
Expand Down
Loading
Loading