import app from '@adonisjs/core/services/app';
import { defineConfig, services } from '@adonisjs/drive';
import env from '../env.js';
const enableS3 = env.get('DRIVE_S3_ACCESS_KEY_ID') !== 'disabled';
const driveConfig = defineConfig({
    default: enableS3 ? 's3' : 'fs',
    services: {
        s3: services.s3({
            credentials: {
                accessKeyId: env.get('DRIVE_S3_ACCESS_KEY_ID'),
                secretAccessKey: env.get('DRIVE_S3_SECRET_ACCESS_KEY'),
            },
            region: env.get('DRIVE_S3_REGION'),
            bucket: env.get('DRIVE_S3_BUCKET'),
            endpoint: env.get('DRIVE_S3_ENDPOINT'),
            visibility: 'public',
            supportsACL: false,
            urlBuilder: {
                generateURL: async (key, bucket, _client) => {
                    return `${env.get('DRIVE_S3_ENDPOINT')}${bucket}/${key}`;
                },
            },
        }),
        fs: services.fs({
            location: app.makePath('storage'),
            serveFiles: true,
            routeBasePath: '/uploads',
            visibility: 'public',
        }),
    },
});
export default driveConfig;
//# sourceMappingURL=drive.js.map