mnemo_cards/mnemo_cards_backend/lib/storage/minio_config.dart
Dmitry de06c74b72
Some checks failed
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Deploy Admin Panel / Deploy Admin Panel (push) Has been cancelled
Deploy Admin Panel / Admin Panel Verification (push) Has been cancelled
voices
2025-12-19 07:18:46 +03:00

40 lines
1.2 KiB
Dart

import 'dart:io';
/// Configuration for MinIO connection
class MinioConfig {
final String endpoint;
final int port;
final String accessKey;
final String secretKey;
final bool useSSL;
final String region;
// Bucket names
// Note: cardImagesBucket is used for all images (both card images and test images)
// to simplify bucket management and reduce complexity
static const String cardImagesBucket = 'card-images';
static const String voiceAudioBucket = 'voice-audio';
// Presigned URL expiration (4 hours)
static const int presignedUrlExpirySeconds = 4 * 60 * 60;
MinioConfig({
required this.endpoint,
required this.port,
required this.accessKey,
required this.secretKey,
required this.useSSL,
required this.region,
});
factory MinioConfig.fromEnvironment() {
return MinioConfig(
endpoint: Platform.environment['MINIO_SERVER_URL']!,
port: int.parse(Platform.environment['MINIO_PORT'] ?? '443'),
accessKey: Platform.environment['SERVICE_USER_MINIO']!,
secretKey: Platform.environment['SERVICE_PASSWORD_MINIO']!,
useSSL: Platform.environment['MINIO_USE_SSL'] != 'false',
region: Platform.environment['MINIO_REGION'] ?? 'us-east-1',
);
}
}