Skip to main content

atlas_common/storage/
config.rs

1//! Storage configuration types
2
3use super::types::StorageType;
4use serde::{Deserialize, Serialize};
5
6/// Storage backend configuration
7///
8/// Contains all necessary information to initialize a storage backend.
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct StorageConfig {
11    /// Type of storage backend
12    pub storage_type: StorageType,
13
14    /// Connection URL (for databases, S3, etc.)
15    pub url: Option<String>,
16
17    /// File system path (for filesystem storage)
18    pub path: Option<String>,
19
20    /// Authentication credentials
21    pub credentials: Option<StorageCredentials>,
22
23    /// Additional backend-specific options as JSON
24    pub options: Option<serde_json::Value>,
25}
26
27/// Storage authentication credentials
28///
29/// Supports various authentication methods for different backends.
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct StorageCredentials {
32    /// Username for basic auth
33    pub username: Option<String>,
34
35    /// Password for basic auth
36    pub password: Option<String>,
37
38    /// Bearer token
39    pub token: Option<String>,
40
41    /// API key
42    pub api_key: Option<String>,
43}
44
45impl Default for StorageConfig {
46    /// Creates default filesystem storage configuration
47    fn default() -> Self {
48        Self {
49            storage_type: StorageType::Filesystem,
50            url: None,
51            path: Some("/tmp/atlas-storage".to_string()),
52            credentials: None,
53            options: None,
54        }
55    }
56}