Go: add more commands and GCS supports (#16741)

### Summary

1. GCS supports
2. More commands
```
RAGFlow(admin)> ping store;
SUCCESS
RAGFlow(admin)> ping engine;
SUCCESS
RAGFlow(admin)> ping cache;
SUCCESS
```

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-08 17:49:02 +08:00
committed by GitHub
parent dc95b1d291
commit 21266286cb
26 changed files with 701 additions and 84 deletions

View File

@@ -210,12 +210,14 @@ type StorageConfig struct {
Minio *MinioConfig `mapstructure:"minio"`
S3 *S3Config `mapstructure:"s3"`
OSS *OSSConfig `mapstructure:"oss"`
GCS *GCSConfig `mapstructure:"gcs"`
}
const (
StorageOSS StorageType = "oss"
StorageS3 StorageType = "s3"
StorageMinio StorageType = "minio"
StorageGCS StorageType = "gcs"
)
// OSSConfig holds Aliyun OSS storage configuration
@@ -231,6 +233,12 @@ type OSSConfig struct {
AddressingStyle string `mapstructure:"addressing_style"` // Addressing style
}
type GCSConfig struct {
Bucket string `mapstructure:"bucket"` // Default bucket (optional)
PrefixPath string `mapstructure:"prefix_path"` // Path prefix (optional)
EndpointURL string `mapstructure:"endpoint_url"` // Custom endpoint (optional)
}
// MinioConfig holds MinIO storage configuration
type MinioConfig struct {
Host string `mapstructure:"host"` // MinIO server host (e.g., "localhost:9000")
@@ -534,6 +542,8 @@ func FromEnvironments() error {
globalConfig.StorageEngine.Type = StorageS3
case "oss":
globalConfig.StorageEngine.Type = StorageOSS
case "gcs":
globalConfig.StorageEngine.Type = StorageGCS
case "":
// Default
if globalConfig.StorageEngine.Type == "" {
@@ -788,6 +798,19 @@ func FromConfigFile(configPath string) error {
}
}
if v.IsSet("gcs") {
gcsConfig := v.Sub("gcs")
if gcsConfig != nil {
if globalConfig.StorageEngine.GCS == nil {
globalConfig.StorageEngine.GCS = &GCSConfig{
Bucket: gcsConfig.GetString("bucket"),
PrefixPath: gcsConfig.GetString("prefix_path"),
EndpointURL: gcsConfig.GetString("endpoint_url"),
}
}
}
}
if v.IsSet("minio_0") {
minioConfig := v.Sub("minio_0")
if minioConfig != nil {