-
Hello, I am using Adonis 4.1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Haven't used s3 with v4. But considering that you can't live reload most config I doupt you can change drive config. |
Beta Was this translation helpful? Give feedback.
-
I have found the solution. drive.js 'use strict'
const Helpers = use('Helpers')
const Env = use('Env')
module.exports = {
/*
|--------------------------------------------------------------------------
| Default disk
|--------------------------------------------------------------------------
|
| The default disk is used when you interact with the file system without
| defining a disk name
|
*/
default: Env.get('FILE_DRIVER'),
disks: {
/*
|--------------------------------------------------------------------------
| Local
|--------------------------------------------------------------------------
|
| Local disk interacts with the a local folder inside your application
|
*/
local: {
root: Helpers.tmpPath(),
driver: 'local',
},
/*
|--------------------------------------------------------------------------
| S3
|--------------------------------------------------------------------------
|
| S3 disk interacts with a bucket on aws s3
|
*/
s3Dataset: {
driver: 's3',
key: Env.get('S3_AWS_KEY_ID'),
secret: Env.get('S3_AWS_SECRET_ACCESS_KEY'),
bucket: Env.get('S3_DATASET_BUCKET_NAME'),
endpoint: Env.get('S3_ENDPOINT_URL'),
s3ForcePathStyle: true,
},
// Static file (images) bucket
s3Static: {
driver: 's3',
key: Env.get('S3_AWS_KEY_ID'),
secret: Env.get('S3_AWS_SECRET_ACCESS_KEY'),
bucket: Env.get('S3_STATIC_BUCKET_NAME'),
endpoint: Env.get('S3_ENDPOINT_URL'),
s3ForcePathStyle: true,
},
},
} Then using it inside a controller like this: await Drive.disk('s3Static').put(filePath, file.stream) |
Beta Was this translation helpful? Give feedback.
I have found the solution.
drive.js