mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-22 21:14:42 +00:00
ftp setup added
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
APP_NAME=Laravel
|
APP_NAME=Laravel
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=base64:qpZihuLxIkDkK3rsQND5Ksv10zVWQ3yih2KiuY6IfXk=
|
APP_KEY=base64:H+C6Ovly2gudhK4Zyn0EOED/ZOKNXthKIr6fv6bXJUM=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
APP_DEMO=false
|
APP_DEMO=false
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## Version 2.0.17
|
||||||
|
#### Release date: 12. April 2022
|
||||||
|
- Added option to use FTP as VueFileManager file storage server
|
||||||
|
|
||||||
## Version 2.0.16
|
## Version 2.0.16
|
||||||
#### Release date: 8. April 2022
|
#### Release date: 8. April 2022
|
||||||
- Test mailgun, ses and postmark connection before storing your credentials into the app
|
- Test mailgun, ses and postmark connection before storing your credentials into the app
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'version' => '2.0.16',
|
'version' => '2.0.17',
|
||||||
|
|
||||||
'is_demo' => env('APP_DEMO', false),
|
'is_demo' => env('APP_DEMO', false),
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
</AppInputText>
|
</AppInputText>
|
||||||
</ValidationProvider>
|
</ValidationProvider>
|
||||||
|
|
||||||
<div v-if="storage.driver !== 'local' && storage.driver">
|
<div v-if="s3PredefinedList.includes(storage.driver)">
|
||||||
<ValidationProvider tag="div" mode="passive" name="Key" rules="required" v-slot="{ errors }">
|
<ValidationProvider tag="div" mode="passive" name="Key" rules="required" v-slot="{ errors }">
|
||||||
<AppInputText title="Key" :error="errors[0]">
|
<AppInputText title="Key" :error="errors[0]">
|
||||||
<input
|
<input
|
||||||
class="focus-border-theme input-dark"
|
class="focus-border-theme input-dark"
|
||||||
v-model="storage.key"
|
v-model="storage.s3.key"
|
||||||
placeholder="Paste your key"
|
placeholder="Paste your key"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ '!border-rose-600': errors[0] }"
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<AppInputText title="Secret" :error="errors[0]">
|
<AppInputText title="Secret" :error="errors[0]">
|
||||||
<input
|
<input
|
||||||
class="focus-border-theme input-dark"
|
class="focus-border-theme input-dark"
|
||||||
v-model="storage.secret"
|
v-model="storage.s3.secret"
|
||||||
placeholder="Paste your secret"
|
placeholder="Paste your secret"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ '!border-rose-600': errors[0] }"
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
@@ -54,9 +54,8 @@
|
|||||||
:error="errors[0]"
|
:error="errors[0]"
|
||||||
>
|
>
|
||||||
<SelectInput
|
<SelectInput
|
||||||
v-model="storage.region"
|
v-model="storage.s3.region"
|
||||||
:options="regionList"
|
:options="regionList"
|
||||||
:default="storage.region"
|
|
||||||
placeholder="Select your region"
|
placeholder="Select your region"
|
||||||
:isError="errors[0]"
|
:isError="errors[0]"
|
||||||
/>
|
/>
|
||||||
@@ -72,7 +71,7 @@
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="focus-border-theme input-dark"
|
class="focus-border-theme input-dark"
|
||||||
v-model="storage.region"
|
v-model="storage.s3.region"
|
||||||
placeholder="Type your region"
|
placeholder="Type your region"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ '!border-rose-600': errors[0] }"
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
@@ -91,7 +90,7 @@
|
|||||||
<AppInputText title="Endpoint URL" :description="endpointUrlDescription" :error="errors[0]">
|
<AppInputText title="Endpoint URL" :description="endpointUrlDescription" :error="errors[0]">
|
||||||
<input
|
<input
|
||||||
class="focus-border-theme input-dark"
|
class="focus-border-theme input-dark"
|
||||||
v-model="storage.endpoint"
|
v-model="storage.s3.endpoint"
|
||||||
placeholder="Type your endpoint"
|
placeholder="Type your endpoint"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ '!border-rose-600': errors[0] }"
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
@@ -109,7 +108,7 @@
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="focus-border-theme input-dark"
|
class="focus-border-theme input-dark"
|
||||||
v-model="storage.bucket"
|
v-model="storage.s3.bucket"
|
||||||
placeholder="Type your bucket name"
|
placeholder="Type your bucket name"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ '!border-rose-600': errors[0] }"
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
@@ -117,6 +116,42 @@
|
|||||||
</AppInputText>
|
</AppInputText>
|
||||||
</ValidationProvider>
|
</ValidationProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="storage.driver === 'ftp'">
|
||||||
|
<ValidationProvider tag="div" mode="passive" name="FTP Host" rules="required" v-slot="{ errors }">
|
||||||
|
<AppInputText title="FTP Host" :error="errors[0]">
|
||||||
|
<input
|
||||||
|
class="focus-border-theme input-dark"
|
||||||
|
v-model="storage.ftp.host"
|
||||||
|
placeholder="Type your ftp host..."
|
||||||
|
type="text"
|
||||||
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
|
/>
|
||||||
|
</AppInputText>
|
||||||
|
</ValidationProvider>
|
||||||
|
<ValidationProvider tag="div" mode="passive" name="FTP Username" rules="required" v-slot="{ errors }">
|
||||||
|
<AppInputText title="FTP Username" :error="errors[0]">
|
||||||
|
<input
|
||||||
|
class="focus-border-theme input-dark"
|
||||||
|
v-model="storage.ftp.user"
|
||||||
|
placeholder="Type your ftp username..."
|
||||||
|
type="text"
|
||||||
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
|
/>
|
||||||
|
</AppInputText>
|
||||||
|
</ValidationProvider>
|
||||||
|
<ValidationProvider tag="div" mode="passive" name="FTP Password" rules="required" v-slot="{ errors }">
|
||||||
|
<AppInputText title="FTP Password" :error="errors[0]" :is-last="true">
|
||||||
|
<input
|
||||||
|
class="focus-border-theme input-dark"
|
||||||
|
v-model="storage.ftp.password"
|
||||||
|
placeholder="Type your ftp password..."
|
||||||
|
type="text"
|
||||||
|
:class="{ '!border-rose-600': errors[0] }"
|
||||||
|
/>
|
||||||
|
</AppInputText>
|
||||||
|
</ValidationProvider>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -143,10 +178,10 @@
|
|||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
'storage.driver': function () {
|
'storage.driver': function () {
|
||||||
this.storage.region = undefined
|
this.storage.s3.region = undefined
|
||||||
},
|
},
|
||||||
'storage.region': function (val) {
|
'storage.s3.region': function (val) {
|
||||||
this.storage.endpoint = {
|
this.storage.s3.endpoint = {
|
||||||
storj: 'https://gateway.' + val + '.storjshare.io',
|
storj: 'https://gateway.' + val + '.storjshare.io',
|
||||||
spaces: 'https://' + val + '.digitaloceanspaces.com',
|
spaces: 'https://' + val + '.digitaloceanspaces.com',
|
||||||
wasabi: 'https://s3.' + val + '.wasabisys.com',
|
wasabi: 'https://s3.' + val + '.wasabisys.com',
|
||||||
@@ -180,11 +215,18 @@
|
|||||||
return {
|
return {
|
||||||
storage: {
|
storage: {
|
||||||
driver: undefined,
|
driver: undefined,
|
||||||
key: undefined,
|
s3: {
|
||||||
secret: undefined,
|
key: undefined,
|
||||||
endpoint: undefined,
|
secret: undefined,
|
||||||
region: undefined,
|
endpoint: undefined,
|
||||||
bucket: undefined,
|
region: undefined,
|
||||||
|
bucket: undefined,
|
||||||
|
},
|
||||||
|
ftp: {
|
||||||
|
host: undefined,
|
||||||
|
user: undefined,
|
||||||
|
password: undefined,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ossRegions: [
|
ossRegions: [
|
||||||
{
|
{
|
||||||
@@ -336,6 +378,15 @@
|
|||||||
value: 'fra1',
|
value: 'fra1',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
s3PredefinedList: [
|
||||||
|
's3',
|
||||||
|
'storj',
|
||||||
|
'spaces',
|
||||||
|
'wasabi',
|
||||||
|
'backblaze',
|
||||||
|
'oss',
|
||||||
|
'other',
|
||||||
|
],
|
||||||
storageServiceList: [
|
storageServiceList: [
|
||||||
{
|
{
|
||||||
label: 'Local Driver',
|
label: 'Local Driver',
|
||||||
@@ -369,6 +420,10 @@
|
|||||||
label: 'Other S3 Compatible Service',
|
label: 'Other S3 Compatible Service',
|
||||||
value: 'other',
|
value: 'other',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'FTP',
|
||||||
|
value: 'ftp',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,9 +309,9 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.response.status === 401 && error.response.data.type === 's3-connection-error') {
|
if ([401, 500].includes(error.response.status)) {
|
||||||
events.$emit('alert:open', {
|
events.$emit('alert:open', {
|
||||||
title: 'S3 Connection Error - Wrong Credentials or Not Permitted',
|
title: error.response.data.title || this.$t('popup_error.title'),
|
||||||
message: error.response.data.message,
|
message: error.response.data.message,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -316,19 +316,11 @@ export default {
|
|||||||
this.$router.push({ name: 'AppSetup' })
|
this.$router.push({ name: 'AppSetup' })
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.response.status === 401 && error.response.data.type === 's3-connection-error') {
|
if ([401, 500].includes(error.response.status)) {
|
||||||
events.$emit('alert:open', {
|
events.$emit('alert:open', {
|
||||||
title: 'S3 Connection Error - Wrong Credentials or Not Permitted',
|
title: error.response.data.title || 'Whooops, something went wrong!',
|
||||||
message: error.response.data.message,
|
message: error.response.data.message,
|
||||||
})
|
})
|
||||||
} else if (
|
|
||||||
error.response.status === 401 &&
|
|
||||||
error.response.data.type === 'mailer-connection-error'
|
|
||||||
) {
|
|
||||||
events.$emit('alert:open', {
|
|
||||||
title: 'Mailer Connection Error - Wrong Credentials',
|
|
||||||
message: error.response.data.message,
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.isError = true
|
this.isError = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class UploadFileAction
|
|||||||
match (config('filesystems.default')) {
|
match (config('filesystems.default')) {
|
||||||
's3' => ($this->moveFileToExternalStorage)($fileName, $user->id),
|
's3' => ($this->moveFileToExternalStorage)($fileName, $user->id),
|
||||||
'ftp', 'azure' => ($this->moveFileToFTPStorage)($fileName, $user->id),
|
'ftp', 'azure' => ($this->moveFileToFTPStorage)($fileName, $user->id),
|
||||||
|
default => null
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create new file
|
// Create new file
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Domain\Settings\Actions;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
use League\Flysystem\Ftp\UnableToAuthenticate;
|
||||||
|
use League\Flysystem\UnableToWriteFile;
|
||||||
|
use Storage;
|
||||||
|
|
||||||
|
class TestFTPConnectionAction
|
||||||
|
{
|
||||||
|
public function __invoke(array $credentials)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// Set temporary ftp connection
|
||||||
|
config([
|
||||||
|
'filesystems.disks.ftp' => [
|
||||||
|
'driver' => 'ftp',
|
||||||
|
'host' => $credentials['host'],
|
||||||
|
'username' => $credentials['user'],
|
||||||
|
'password' => $credentials['password'],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Try to get files
|
||||||
|
Storage::disk('ftp')->allFiles();
|
||||||
|
|
||||||
|
// Try to create folder
|
||||||
|
Storage::disk('ftp')->makeDirectory('ftp-test');
|
||||||
|
|
||||||
|
// Delete test folder
|
||||||
|
Storage::disk('ftp')->deleteDirectory('ftp-test');
|
||||||
|
} catch (ErrorException | UnableToWriteFile | UnableToAuthenticate $error) {
|
||||||
|
abort(
|
||||||
|
response()->json([
|
||||||
|
'type' => 'ftp-connection-error',
|
||||||
|
'title' => 'FTP Connection Error',
|
||||||
|
'message' => $error->getMessage(),
|
||||||
|
], 401)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ class TestS3ConnectionAction
|
|||||||
abort(
|
abort(
|
||||||
response()->json([
|
response()->json([
|
||||||
'type' => 's3-connection-error',
|
'type' => 's3-connection-error',
|
||||||
'title' => 'S3 Connection Error',
|
'title' => 'S3 Connection Error - Wrong Credentials or Not Permitted',
|
||||||
'message' => $error->getMessage(),
|
'message' => $error->getMessage(),
|
||||||
], 401)
|
], 401)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class TestSMTPConnectionAction
|
|||||||
abort(
|
abort(
|
||||||
response()->json([
|
response()->json([
|
||||||
'type' => 'mailer-connection-error',
|
'type' => 'mailer-connection-error',
|
||||||
'title' => 'Mail Connection Error',
|
'title' => 'Mailer Connection Error - Wrong Credentials',
|
||||||
'message' => $error->getMessage(),
|
'message' => $error->getMessage(),
|
||||||
], 401)
|
], 401)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
namespace Domain\Settings\Controllers;
|
namespace Domain\Settings\Controllers;
|
||||||
|
|
||||||
use Artisan;
|
use Artisan;
|
||||||
|
use Domain\Settings\Actions\TestFTPConnectionAction;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Aws\S3\Exception\S3Exception;
|
|
||||||
use League\Flysystem\UnableToWriteFile;
|
|
||||||
use Domain\Settings\DTO\S3CredentialsData;
|
use Domain\Settings\DTO\S3CredentialsData;
|
||||||
use Domain\Settings\Actions\TestS3ConnectionAction;
|
use Domain\Settings\Actions\TestS3ConnectionAction;
|
||||||
use Domain\Settings\Requests\StoreStorageCredentialsRequest;
|
use Domain\Settings\Requests\StoreStorageCredentialsRequest;
|
||||||
@@ -12,9 +11,9 @@ use Domain\Settings\Requests\StoreStorageCredentialsRequest;
|
|||||||
class StoreStorageCredentialsController
|
class StoreStorageCredentialsController
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
private TestFTPConnectionAction $testFTPConnection,
|
||||||
private TestS3ConnectionAction $testS3Connection,
|
private TestS3ConnectionAction $testS3Connection,
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set new email credentials to .env file
|
* Set new email credentials to .env file
|
||||||
@@ -24,20 +23,27 @@ class StoreStorageCredentialsController
|
|||||||
// Abort in demo mode
|
// Abort in demo mode
|
||||||
abort_if(is_demo(), 204, 'Done.');
|
abort_if(is_demo(), 204, 'Done.');
|
||||||
|
|
||||||
|
// Get storage driver from request
|
||||||
|
$driver = match ($request->input('storage.driver')) {
|
||||||
|
's3', 'storj', 'spaces', 'wasabi', 'backblaze', 'oss', 'other' => 's3',
|
||||||
|
'local' => 'local',
|
||||||
|
'ftp' => 'ftp',
|
||||||
|
};
|
||||||
|
|
||||||
if (! app()->runningUnitTests()) {
|
if (! app()->runningUnitTests()) {
|
||||||
// Test s3 credentials
|
|
||||||
if ($request->input('storage.driver') !== 'local') {
|
// Test driver connection
|
||||||
try {
|
match ($driver) {
|
||||||
// connect to the s3
|
's3' => ($this->testS3Connection)(
|
||||||
($this->testS3Connection)(S3CredentialsData::fromRequest($request));
|
S3CredentialsData::fromRequest($request)
|
||||||
} catch (S3Exception | UnableToWriteFile $error) {
|
),
|
||||||
return response([
|
'ftp' => ($this->testFTPConnection)([
|
||||||
'type' => 's3-connection-error',
|
'host' => $request->input('storage.ftp.host'),
|
||||||
'title' => 'S3 Connection Error',
|
'user' => $request->input('storage.ftp.user'),
|
||||||
'message' => $error->getMessage(),
|
'password' => $request->input('storage.ftp.password'),
|
||||||
], 401);
|
]),
|
||||||
}
|
default => null
|
||||||
}
|
};
|
||||||
|
|
||||||
$drivers = [
|
$drivers = [
|
||||||
'local' => [
|
'local' => [
|
||||||
@@ -45,17 +51,20 @@ class StoreStorageCredentialsController
|
|||||||
],
|
],
|
||||||
's3' => [
|
's3' => [
|
||||||
'FILESYSTEM_DISK' => 's3',
|
'FILESYSTEM_DISK' => 's3',
|
||||||
'S3_ACCESS_KEY_ID' => $request->input('storage.key') ?? null,
|
'S3_ACCESS_KEY_ID' => $request->input('storage.s3.key') ?? null,
|
||||||
'S3_SECRET_ACCESS_KEY' => $request->input('storage.secret') ?? null,
|
'S3_SECRET_ACCESS_KEY' => $request->input('storage.s3.secret') ?? null,
|
||||||
'S3_DEFAULT_REGION' => $request->input('storage.region') ?? null,
|
'S3_DEFAULT_REGION' => $request->input('storage.s3.region') ?? null,
|
||||||
'S3_BUCKET' => $request->input('storage.bucket') ?? null,
|
'S3_BUCKET' => $request->input('storage.s3.bucket') ?? null,
|
||||||
'S3_URL' => $request->input('storage.endpoint') ?? null,
|
'S3_URL' => $request->input('storage.s3.endpoint') ?? null,
|
||||||
|
],
|
||||||
|
'ftp' => [
|
||||||
|
'FILESYSTEM_DISK' => 'ftp',
|
||||||
|
'FTP_HOST' => $request->input('storage.ftp.host') ?? null,
|
||||||
|
'FTP_USERNAME' => $request->input('storage.ftp.user') ?? null,
|
||||||
|
'FTP_PASSWORD' => $request->input('storage.ftp.password') ?? null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// Get storage driver from request
|
|
||||||
$driver = 'local' === $request->input('storage.driver') ? 'local' : 's3';
|
|
||||||
|
|
||||||
// Storage credentials for storage
|
// Storage credentials for storage
|
||||||
setEnvironmentValue($drivers[$driver]);
|
setEnvironmentValue($drivers[$driver]);
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ class S3CredentialsData extends DataTransferObject
|
|||||||
public static function fromRequest($request): self
|
public static function fromRequest($request): self
|
||||||
{
|
{
|
||||||
return new self([
|
return new self([
|
||||||
'key' => $request->input('storage.key'),
|
'key' => $request->input('storage.s3.key'),
|
||||||
'secret' => $request->input('storage.secret'),
|
'secret' => $request->input('storage.s3.secret'),
|
||||||
'region' => $request->input('storage.region'),
|
'region' => $request->input('storage.s3.region'),
|
||||||
'bucket' => $request->input('storage.bucket'),
|
'bucket' => $request->input('storage.s3.bucket'),
|
||||||
'endpoint' => $request->input('storage.endpoint'),
|
'endpoint' => $request->input('storage.s3.endpoint'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace Domain\SetupWizard\Controllers;
|
namespace Domain\SetupWizard\Controllers;
|
||||||
|
|
||||||
use Artisan;
|
use Artisan;
|
||||||
|
use Domain\Settings\Actions\TestFTPConnectionAction;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Domain\Settings\DTO\S3CredentialsData;
|
use Domain\Settings\DTO\S3CredentialsData;
|
||||||
@@ -17,11 +18,11 @@ class StoreEnvironmentSettingsController extends Controller
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private TestS3ConnectionAction $testS3Connection,
|
private TestS3ConnectionAction $testS3Connection,
|
||||||
private TestSESConnectionAction $testSESConnection,
|
private TestSESConnectionAction $testSESConnection,
|
||||||
|
private TestFTPConnectionAction $testFTPConnection,
|
||||||
private TestSMTPConnectionAction $testSMTPConnection,
|
private TestSMTPConnectionAction $testSMTPConnection,
|
||||||
private TestMailgunConnectionAction $testMailgunConnection,
|
private TestMailgunConnectionAction $testMailgunConnection,
|
||||||
private TestPostmarkConnectionAction $testPostmarkConnection,
|
private TestPostmarkConnectionAction $testPostmarkConnection,
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store environment setup
|
* Store environment setup
|
||||||
@@ -30,10 +31,25 @@ class StoreEnvironmentSettingsController extends Controller
|
|||||||
StoreEnvironmentSetupRequest $request,
|
StoreEnvironmentSetupRequest $request,
|
||||||
): JsonResponse {
|
): JsonResponse {
|
||||||
if (! app()->runningUnitTests()) {
|
if (! app()->runningUnitTests()) {
|
||||||
// Test s3 credentials
|
// Get storage driver from request
|
||||||
if ($request->input('storage.driver') !== 'local') {
|
$StorageDriver = match ($request->input('storage.driver')) {
|
||||||
($this->testS3Connection)(S3CredentialsData::fromRequest($request));
|
's3', 'storj', 'spaces', 'wasabi', 'backblaze', 'oss', 'other' => 's3',
|
||||||
}
|
'local' => 'local',
|
||||||
|
'ftp' => 'ftp',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test driver connection
|
||||||
|
match ($StorageDriver) {
|
||||||
|
's3' => ($this->testS3Connection)(
|
||||||
|
S3CredentialsData::fromRequest($request)
|
||||||
|
),
|
||||||
|
'ftp' => ($this->testFTPConnection)([
|
||||||
|
'host' => $request->input('storage.ftp.host'),
|
||||||
|
'user' => $request->input('storage.ftp.user'),
|
||||||
|
'password' => $request->input('storage.ftp.password'),
|
||||||
|
]),
|
||||||
|
default => null
|
||||||
|
};
|
||||||
|
|
||||||
// Test email connection
|
// Test email connection
|
||||||
match ($request->input('mailDriver')) {
|
match ($request->input('mailDriver')) {
|
||||||
@@ -93,11 +109,17 @@ class StoreEnvironmentSettingsController extends Controller
|
|||||||
],
|
],
|
||||||
's3' => [
|
's3' => [
|
||||||
'FILESYSTEM_DISK' => 's3',
|
'FILESYSTEM_DISK' => 's3',
|
||||||
'S3_ACCESS_KEY_ID' => $request->input('storage.key') ?? null,
|
'S3_ACCESS_KEY_ID' => $request->input('storage.s3.key') ?? null,
|
||||||
'S3_SECRET_ACCESS_KEY' => $request->input('storage.secret') ?? null,
|
'S3_SECRET_ACCESS_KEY' => $request->input('storage.s3.secret') ?? null,
|
||||||
'S3_DEFAULT_REGION' => $request->input('storage.region') ?? null,
|
'S3_DEFAULT_REGION' => $request->input('storage.s3.region') ?? null,
|
||||||
'S3_BUCKET' => $request->input('storage.bucket') ?? null,
|
'S3_BUCKET' => $request->input('storage.s3.bucket') ?? null,
|
||||||
'S3_URL' => $request->input('storage.endpoint') ?? null,
|
'S3_URL' => $request->input('storage.s3.endpoint') ?? null,
|
||||||
|
],
|
||||||
|
'ftp' => [
|
||||||
|
'FILESYSTEM_DISK' => 'ftp',
|
||||||
|
'FTP_HOST' => $request->input('storage.ftp.host') ?? null,
|
||||||
|
'FTP_USERNAME' => $request->input('storage.ftp.user') ?? null,
|
||||||
|
'FTP_PASSWORD' => $request->input('storage.ftp.password') ?? null,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'mail' => [
|
'mail' => [
|
||||||
@@ -155,15 +177,12 @@ class StoreEnvironmentSettingsController extends Controller
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
// Get storage driver from request
|
|
||||||
$driver = 'local' === $request->input('storage.driver') ? 'local' : 's3';
|
|
||||||
|
|
||||||
// Set other environment variables
|
// Set other environment variables
|
||||||
setEnvironmentValue(array_merge(
|
setEnvironmentValue(array_merge(
|
||||||
$setup['broadcasting'][$request->input('broadcast.driver')],
|
$setup['broadcasting'][$request->input('broadcast.driver')],
|
||||||
$setup['environment'][$request->input('environment')],
|
$setup['environment'][$request->input('environment')],
|
||||||
$setup['mail'][$request->input('mailDriver')],
|
$setup['mail'][$request->input('mailDriver')],
|
||||||
$setup['drivers'][$driver],
|
$setup['drivers'][$StorageDriver],
|
||||||
$setup['others'],
|
$setup['others'],
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user