feat(config): add MinIO object storage configuration
Add MinioConfig struct with connection, bucket, chunk size, and session TTL settings. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -20,15 +20,29 @@ type LogConfig struct {
|
||||
GormLevel string `yaml:"gorm_level"` // GORM SQL log level (default: warn)
|
||||
}
|
||||
|
||||
// MinioConfig holds MinIO object storage configuration values.
|
||||
type MinioConfig struct {
|
||||
Endpoint string `yaml:"endpoint"` // MinIO server address
|
||||
AccessKey string `yaml:"access_key"` // access key
|
||||
SecretKey string `yaml:"secret_key"` // secret key
|
||||
Bucket string `yaml:"bucket"` // bucket name
|
||||
UseSSL bool `yaml:"use_ssl"` // use TLS connection
|
||||
ChunkSize int64 `yaml:"chunk_size"` // upload chunk size in bytes (default: 16MB)
|
||||
MaxFileSize int64 `yaml:"max_file_size"` // max file size in bytes (default: 50GB)
|
||||
MinChunkSize int64 `yaml:"min_chunk_size"` // minimum chunk size in bytes (default: 5MB)
|
||||
SessionTTL int `yaml:"session_ttl"` // session TTL in hours (default: 48)
|
||||
}
|
||||
|
||||
// Config holds all application configuration values.
|
||||
type Config struct {
|
||||
ServerPort string `yaml:"server_port"`
|
||||
SlurmAPIURL string `yaml:"slurm_api_url"`
|
||||
SlurmUserName string `yaml:"slurm_user_name"`
|
||||
SlurmJWTKeyPath string `yaml:"slurm_jwt_key_path"`
|
||||
MySQLDSN string `yaml:"mysql_dsn"`
|
||||
WorkDirBase string `yaml:"work_dir_base"` // base directory for job work dirs
|
||||
Log LogConfig `yaml:"log"`
|
||||
ServerPort string `yaml:"server_port"`
|
||||
SlurmAPIURL string `yaml:"slurm_api_url"`
|
||||
SlurmUserName string `yaml:"slurm_user_name"`
|
||||
SlurmJWTKeyPath string `yaml:"slurm_jwt_key_path"`
|
||||
MySQLDSN string `yaml:"mysql_dsn"`
|
||||
WorkDirBase string `yaml:"work_dir_base"` // base directory for job work dirs
|
||||
Log LogConfig `yaml:"log"`
|
||||
Minio MinioConfig `yaml:"minio"`
|
||||
}
|
||||
|
||||
// Load reads a YAML configuration file and returns a parsed Config.
|
||||
@@ -48,5 +62,18 @@ func Load(path string) (*Config, error) {
|
||||
return nil, fmt.Errorf("parse config file %s: %w", path, err)
|
||||
}
|
||||
|
||||
if cfg.Minio.ChunkSize == 0 {
|
||||
cfg.Minio.ChunkSize = 16 << 20 // 16MB
|
||||
}
|
||||
if cfg.Minio.MaxFileSize == 0 {
|
||||
cfg.Minio.MaxFileSize = 50 << 30 // 50GB
|
||||
}
|
||||
if cfg.Minio.MinChunkSize == 0 {
|
||||
cfg.Minio.MinChunkSize = 5 << 20 // 5MB
|
||||
}
|
||||
if cfg.Minio.SessionTTL == 0 {
|
||||
cfg.Minio.SessionTTL = 48
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user