diff options
| author | 2026-04-15 16:26:00 +0700 | |
|---|---|---|
| committer | 2026-04-15 16:26:00 +0700 | |
| commit | 129e48683f6fc0615b606a737f2afcd50538bb2e (patch) | |
| tree | 4c9481f725bef512ca58cb6daaef467f9ca1de2c /config/config.go | |
| parent | d3b9bd54cc3e13b5a9d16404717551238eab18c6 (diff) | |
| download | articlator-129e48683f6fc0615b606a737f2afcd50538bb2e.tar.gz articlator-129e48683f6fc0615b606a737f2afcd50538bb2e.zip | |
feat: s3 storage client
feat: claude.md
Diffstat (limited to 'config/config.go')
| -rw-r--r-- | config/config.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go index b41be13..543413f 100644 --- a/config/config.go +++ b/config/config.go @@ -24,7 +24,7 @@ type DraftModeConfig struct { } type StorageConfig struct { - Type string `json:"Type" validate:"required,oneof=b2"` + Type string `json:"Type" validate:"required,oneof=b2 s3"` Config any `json:"Config" validate:"required"` } @@ -47,6 +47,12 @@ func (sc *StorageConfig) UnmarshalJSON(data []byte) error { return fmt.Errorf("unmarshal B2Config: %w", err) } sc.Config = &b2Config + case "s3": + var s3Config S3Config + if err := json.Unmarshal(tmp.Config, &s3Config); err != nil { + return fmt.Errorf("unmarshal S3Config: %w", err) + } + sc.Config = &s3Config default: return fmt.Errorf("unsupported storage type: %s", tmp.Type) } @@ -62,6 +68,16 @@ type B2Config struct { ApplicationKey string `json:"ApplicationKey"` } +type S3Config struct { + BucketName string `json:"BucketName" validate:"required,min=1"` + Region string `json:"Region" validate:"required,min=1"` + Prefix string `json:"Prefix"` + Endpoint string `json:"Endpoint"` + UsePathStyle bool `json:"UsePathStyle"` + AccessKeyID string `json:"AccessKeyID"` + SecretAccessKey string `json:"SecretAccessKey"` +} + func LoadConfig(path string, config *Config) error { fileBytes, err := os.ReadFile(path) if err != nil { |