refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// backendScopedFileService makes the storage instance part of every newly
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func TestBackendScopedLocalURLRetainsBackendID(t *testing.T) {
|
||||
t.Setenv("SYSTEM_SIGNING_KEY", "")
|
||||
t.Setenv("SYSTEM_AES_KEY", "0123456789abcdef0123456789abcdef")
|
||||
inner := NewLocalFileService(t.TempDir(), "https://weknora.example.com/base")
|
||||
inner := NewLocalFileService(t.TempDir(), "https://academy.example.com/base")
|
||||
svc := NewBackendScopedFileService("backend-local-a", inner)
|
||||
|
||||
path, err := svc.SaveBytes(context.Background(), []byte("hello"), 7, "exports/image.txt", false)
|
||||
|
||||
@@ -16,9 +16,9 @@ func TestStorageBackendInnerPath(t *testing.T) {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"canonical s3 path", "storage://be-1/s3://weknora/data/a.jpg", "s3://weknora/data/a.jpg"},
|
||||
{"canonical minio path", "storage://be-1/minio://weknora/data/a.jpg", "minio://weknora/data/a.jpg"},
|
||||
{"bare provider path unchanged", "s3://weknora/data/a.jpg", "s3://weknora/data/a.jpg"},
|
||||
{"canonical s3 path", "storage://be-1/s3://academy/data/a.jpg", "s3://academy/data/a.jpg"},
|
||||
{"canonical minio path", "storage://be-1/minio://academy/data/a.jpg", "minio://academy/data/a.jpg"},
|
||||
{"bare provider path unchanged", "s3://academy/data/a.jpg", "s3://academy/data/a.jpg"},
|
||||
{
|
||||
"legacy URL unchanged",
|
||||
"https://bucket.cos.region.myqcloud.com/a.jpg",
|
||||
@@ -36,9 +36,9 @@ func TestStorageBackendInnerPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseS3FilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
svc := &s3FileService{bucketName: "weknora"}
|
||||
svc := &s3FileService{bucketName: "academy"}
|
||||
|
||||
got, err := svc.parseS3FilePath("storage://be-1/s3://weknora/data/10000/exports/a.jpg")
|
||||
got, err := svc.parseS3FilePath("storage://be-1/s3://academy/data/10000/exports/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func TestParseS3FilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
}
|
||||
|
||||
// Bare provider paths keep working.
|
||||
if got, err := svc.parseS3FilePath("s3://weknora/data/a.jpg"); err != nil || got != "data/a.jpg" {
|
||||
if got, err := svc.parseS3FilePath("s3://academy/data/a.jpg"); err != nil || got != "data/a.jpg" {
|
||||
t.Fatalf("bare path: key=%q err=%v", got, err)
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ func TestParseS3FilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseMinioFilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
svc := &minioFileService{bucketName: "weknora"}
|
||||
svc := &minioFileService{bucketName: "academy"}
|
||||
|
||||
got, err := svc.parseMinioFilePath("storage://be-1/minio://weknora/data/a.jpg")
|
||||
got, err := svc.parseMinioFilePath("storage://be-1/minio://academy/data/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
@@ -73,57 +73,57 @@ func TestParseMinioFilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
t.Fatalf("object key = %q, want %q", got, "data/a.jpg")
|
||||
}
|
||||
|
||||
if _, err := svc.parseMinioFilePath("minio://weknora/data/a.jpg"); err != nil {
|
||||
if _, err := svc.parseMinioFilePath("minio://academy/data/a.jpg"); err != nil {
|
||||
t.Fatalf("bare path rejected: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseOssFilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
bucket, key, err := parseOssFilePath("storage://be-1/oss://weknora/data/a.jpg")
|
||||
bucket, key, err := parseOssFilePath("storage://be-1/oss://academy/data/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
if bucket != "weknora" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want weknora/data/a.jpg", bucket, key)
|
||||
if bucket != "academy" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want academy/data/a.jpg", bucket, key)
|
||||
}
|
||||
|
||||
if _, _, err := parseOssFilePath("oss://weknora/data/a.jpg"); err != nil {
|
||||
if _, _, err := parseOssFilePath("oss://academy/data/a.jpg"); err != nil {
|
||||
t.Fatalf("bare path rejected: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseKS3FilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
bucket, key, err := parseKS3FilePath("storage://be-1/ks3://weknora/data/a.jpg")
|
||||
bucket, key, err := parseKS3FilePath("storage://be-1/ks3://academy/data/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
if bucket != "weknora" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want weknora/data/a.jpg", bucket, key)
|
||||
if bucket != "academy" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want academy/data/a.jpg", bucket, key)
|
||||
}
|
||||
|
||||
if _, _, err := parseKS3FilePath("ks3://weknora/data/a.jpg"); err != nil {
|
||||
if _, _, err := parseKS3FilePath("ks3://academy/data/a.jpg"); err != nil {
|
||||
t.Fatalf("bare path rejected: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTOSFilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
bucket, key, err := parseTOSFilePath("storage://be-1/tos://weknora/data/a.jpg")
|
||||
bucket, key, err := parseTOSFilePath("storage://be-1/tos://academy/data/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
if bucket != "weknora" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want weknora/data/a.jpg", bucket, key)
|
||||
if bucket != "academy" || key != "data/a.jpg" {
|
||||
t.Fatalf("bucket=%q key=%q, want academy/data/a.jpg", bucket, key)
|
||||
}
|
||||
|
||||
if _, _, err := parseTOSFilePath("tos://weknora/data/a.jpg"); err != nil {
|
||||
if _, _, err := parseTOSFilePath("tos://academy/data/a.jpg"); err != nil {
|
||||
t.Fatalf("bare path rejected: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseObsFilePathAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
svc := &obsFileService{bucketName: "weknora"}
|
||||
svc := &obsFileService{bucketName: "academy"}
|
||||
|
||||
got, err := svc.parseObsFilePath("storage://be-1/obs://weknora/data/a.jpg")
|
||||
got, err := svc.parseObsFilePath("storage://be-1/obs://academy/data/a.jpg")
|
||||
if err != nil {
|
||||
t.Fatalf("canonical path rejected: %v", err)
|
||||
}
|
||||
@@ -152,7 +152,7 @@ func TestParseCosObjectNameAcceptsCanonicalBackendPath(t *testing.T) {
|
||||
|
||||
// Cross-provider canonical paths must still be rejected, not silently
|
||||
// passed to the legacy-URL branch.
|
||||
if _, err := svc.parseCosObjectName("storage://be-1/s3://weknora/data/a.jpg"); err == nil {
|
||||
if _, err := svc.parseCosObjectName("storage://be-1/s3://academy/data/a.jpg"); err == nil {
|
||||
t.Fatal("expected error for foreign provider path")
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
"github.com/tencentyun/cos-go-sdk-v5"
|
||||
)
|
||||
|
||||
@@ -16,9 +16,9 @@ func TestParseCosObjectName_RejectsLocalScheme(t *testing.T) {
|
||||
|
||||
func TestParseCosObjectName_CosScheme(t *testing.T) {
|
||||
svc := &cosFileService{bucketURL: "https://b.cos.ap-shanghai.myqcloud.com/"}
|
||||
key, err := svc.parseCosObjectName("cos://bucket/ap-shanghai/weknora/10000/exports/a.png")
|
||||
key, err := svc.parseCosObjectName("cos://bucket/ap-shanghai/academy/10000/exports/a.png")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "weknora/10000/exports/a.png", key)
|
||||
assert.Equal(t, "academy/10000/exports/a.png", key)
|
||||
}
|
||||
|
||||
func TestParseCosObjectName_RejectsMinioScheme(t *testing.T) {
|
||||
@@ -33,18 +33,18 @@ func TestParseCosObjectName_RejectsMinioScheme(t *testing.T) {
|
||||
// reads tenant 7's file from the shared bucket. Both must match the service.
|
||||
func TestParseCosObjectName_RejectsForeignBucketOrRegion(t *testing.T) {
|
||||
svc := &cosFileService{
|
||||
bucketURL: "https://weknora-1250000000.cos.ap-shanghai.myqcloud.com/",
|
||||
bucketName: "weknora-1250000000",
|
||||
bucketURL: "https://academy-1250000000.cos.ap-shanghai.myqcloud.com/",
|
||||
bucketName: "academy-1250000000",
|
||||
region: "ap-shanghai",
|
||||
}
|
||||
for _, path := range []string{
|
||||
"cos://42/ap-shanghai/weknora/7/knowledge/secret.pdf",
|
||||
"cos://weknora-1250000000/42/weknora/7/knowledge/secret.pdf",
|
||||
"cos://42/ap-shanghai/academy/7/knowledge/secret.pdf",
|
||||
"cos://academy-1250000000/42/academy/7/knowledge/secret.pdf",
|
||||
} {
|
||||
_, err := svc.parseCosObjectName(path)
|
||||
require.Error(t, err, path)
|
||||
}
|
||||
key, err := svc.parseCosObjectName("cos://weknora-1250000000/ap-shanghai/weknora/42/exports/a.png")
|
||||
key, err := svc.parseCosObjectName("cos://academy-1250000000/ap-shanghai/academy/42/exports/a.png")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "weknora/42/exports/a.png", key)
|
||||
assert.Equal(t, "academy/42/exports/a.png", key)
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"io"
|
||||
"mime/multipart"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// NewFileServiceFromStorageConfig builds a provider-specific FileService from tenant storage config.
|
||||
@@ -74,7 +74,7 @@ func NewFileServiceFromStorageConfig(
|
||||
}
|
||||
pathPrefix := strings.TrimSpace(sec.COS.PathPrefix)
|
||||
if pathPrefix == "" {
|
||||
pathPrefix = "weknora"
|
||||
pathPrefix = "academy"
|
||||
}
|
||||
svc, err := NewCosFileServiceWithTempBucket(sec.COS.BucketName, sec.COS.Region, sec.COS.SecretID, sec.COS.SecretKey, pathPrefix, sec.COS.TempBucketName, sec.COS.TempRegion)
|
||||
return svc, p, err
|
||||
@@ -91,7 +91,7 @@ func NewFileServiceFromStorageConfig(
|
||||
}
|
||||
pathPrefix := strings.TrimSpace(sec.S3.PathPrefix)
|
||||
if pathPrefix == "" {
|
||||
pathPrefix = "weknora/"
|
||||
pathPrefix = "academy/"
|
||||
}
|
||||
svc, err := NewS3FileServiceWithOptions(sec.S3.Endpoint, sec.S3.AccessKey, sec.S3.SecretKey, sec.S3.BucketName, sec.S3.Region, pathPrefix, sec.S3.ForcePathStyle)
|
||||
return svc, p, err
|
||||
@@ -126,7 +126,7 @@ func NewFileServiceFromStorageConfig(
|
||||
obsPathPrefix = strings.TrimSpace(os.Getenv("OBS_PATH_PREFIX"))
|
||||
}
|
||||
if obsPathPrefix == "" {
|
||||
obsPathPrefix = "weknora/"
|
||||
obsPathPrefix = "academy/"
|
||||
}
|
||||
if obsEndpoint == "" || obsAccessKey == "" || obsSecretKey == "" || obsBucketName == "" {
|
||||
return nil, p, fmt.Errorf("incomplete obs config")
|
||||
@@ -143,7 +143,7 @@ func NewFileServiceFromStorageConfig(
|
||||
}
|
||||
pathPrefix := strings.TrimSpace(sec.OSS.PathPrefix)
|
||||
if pathPrefix == "" {
|
||||
pathPrefix = "weknora/"
|
||||
pathPrefix = "academy/"
|
||||
}
|
||||
var svc interfaces.FileService
|
||||
var err error
|
||||
@@ -167,7 +167,7 @@ func NewFileServiceFromStorageConfig(
|
||||
}
|
||||
pathPrefix := strings.TrimSpace(sec.KS3.PathPrefix)
|
||||
if pathPrefix == "" {
|
||||
pathPrefix = "weknora/"
|
||||
pathPrefix = "academy/"
|
||||
}
|
||||
svc, err := NewKS3FileService(sec.KS3.Endpoint, sec.KS3.Region, sec.KS3.AccessKey, sec.KS3.SecretKey, sec.KS3.BucketName, pathPrefix)
|
||||
return svc, p, err
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
ks3aws "github.com/ks3sdklib/aws-sdk-go/aws"
|
||||
"github.com/ks3sdklib/aws-sdk-go/aws/awserr"
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
// The bucket is not part of the KS3 object key, but the tenant check scans it;
|
||||
// a numeric bucket segment must not pass as the caller's tenant.
|
||||
func TestKS3ObjectKeyRequiresTheServiceBucket(t *testing.T) {
|
||||
svc := &ks3FileService{bucketName: "weknora"}
|
||||
svc := &ks3FileService{bucketName: "academy"}
|
||||
_, err := svc.objectKey("ks3://42/prefix/7/knowledge/secret.pdf")
|
||||
require.Error(t, err)
|
||||
|
||||
key, err := svc.objectKey("ks3://weknora/prefix/42/exports/a.png")
|
||||
key, err := svc.objectKey("ks3://academy/prefix/42/exports/a.png")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "prefix/42/exports/a.png", key)
|
||||
}
|
||||
@@ -24,7 +24,7 @@ func TestKS3ObjectKeyRequiresTheServiceBucket(t *testing.T) {
|
||||
// A server-side copy reads only this service's bucket; another bucket's path
|
||||
// is reported as a cross-backend copy so the caller streams it instead.
|
||||
func TestKS3CopyFileRejectsForeignBucket(t *testing.T) {
|
||||
svc := &ks3FileService{bucketName: "weknora"}
|
||||
svc := &ks3FileService{bucketName: "academy"}
|
||||
_, err := svc.CopyFile(context.Background(), "ks3://other-bucket/prefix/7/knowledge/a.pdf", 42, "k-1")
|
||||
require.True(t, errors.Is(err, ErrCrossBackendCopy), "err = %v", err)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/utils"
|
||||
)
|
||||
|
||||
// The KS3 SDK replaces the redirect policy on the client it is given with
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// localFileService implements the FileService interface for local file system storage
|
||||
@@ -36,7 +36,7 @@ func (s *localFileService) CheckConnectivity(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// NewLocalFileService creates a new local file service instance.
|
||||
// externalURL is the externally-reachable base URL (e.g. "https://weknora.example.com");
|
||||
// externalURL is the externally-reachable base URL (e.g. "https://academy.example.com");
|
||||
// when set, GetFileURL returns presigned HTTP URLs instead of local:// paths.
|
||||
func NewLocalFileService(baseDir, externalURL string) interfaces.FileService {
|
||||
return &localFileService{
|
||||
|
||||
@@ -24,9 +24,9 @@ func extractTenantIDFromPresignedURL(t *testing.T, presigned string) string {
|
||||
// shared resources resolve to the correct owning tenant's storage config.
|
||||
func TestLocalGetFileURL_TenantIDFromPath(t *testing.T) {
|
||||
t.Setenv("SYSTEM_SIGNING_KEY", "")
|
||||
t.Setenv("SYSTEM_AES_KEY", "weknora-test-aes-key-32bytes!!!")
|
||||
t.Setenv("SYSTEM_AES_KEY", "academy-test-aes-key-32bytes!!!")
|
||||
|
||||
svc := NewLocalFileService("/data/files", "https://weknora.example.com")
|
||||
svc := NewLocalFileService("/data/files", "https://academy.example.com")
|
||||
|
||||
got, err := svc.GetFileURL(context.Background(), "local://7/abc/img.png")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tencentyun/cos-go-sdk-v5"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/utils"
|
||||
)
|
||||
|
||||
// The object storage clients must not carry Go's whole-request timeout: it
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss"
|
||||
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss/credentials"
|
||||
"github.com/google/uuid"
|
||||
|
||||
@@ -202,7 +202,7 @@ func TestOssEnsureBucket_CreateFails(t *testing.T) {
|
||||
// create path is exercised; with invalid credentials PutBucket then fails.
|
||||
// A common name like "test-bucket" already exists globally on OSS, which
|
||||
// would short-circuit at IsBucketExist and make this assertion flaky.
|
||||
err = ossEnsureBucket(client, "weknora-nonexistent-bucket-create-fails-12345")
|
||||
err = ossEnsureBucket(client, "academy-nonexistent-bucket-create-fails-12345")
|
||||
if err == nil {
|
||||
t.Error("ossEnsureBucket with invalid credentials should return an error")
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// ResolveTenantFileServiceWithFallback applies the storage resolution and
|
||||
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// resourceCatalogFileService keeps provider drivers physical-path-only while
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -109,7 +109,7 @@ func TestResourceCatalogFileServiceReturnsReferenceAndResolvesReads(t *testing.T
|
||||
}
|
||||
|
||||
func TestResourceCatalogFileServiceReturnsShortExternalGrantURL(t *testing.T) {
|
||||
t.Setenv("APP_EXTERNAL_URL", "https://weknora.example.com/")
|
||||
t.Setenv("APP_EXTERNAL_URL", "https://academy.example.com/")
|
||||
inner := &physicalFileStub{savedPath: "local://7/exports/a.png"}
|
||||
catalog := &catalogStub{}
|
||||
svc := NewResourceCatalogFileService(inner, catalog)
|
||||
@@ -118,5 +118,5 @@ func TestResourceCatalogFileServiceReturnsShortExternalGrantURL(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
externalURL, err := svc.GetFileURL(context.Background(), ref)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "https://weknora.example.com/r/GrantTokenAbCdEfGhIjKl", externalURL)
|
||||
require.Equal(t, "https://academy.example.com/r/GrantTokenAbCdEfGhIjKl", externalURL)
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/config"
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
@@ -57,7 +57,7 @@ func newS3Client(endpoint, accessKey, secretKey, bucketName, region, pathPrefix
|
||||
|
||||
// With no explicit AK/SK, keep the AWS default credential chain intact. This
|
||||
// supports IAM roles for EC2/ECS/EKS (IRSA), web identity, shared config, and
|
||||
// environment credentials without persisting long-lived keys in WeKnora.
|
||||
// environment credentials without persisting long-lived keys in Academy.
|
||||
loadOptions := []func(*config.LoadOptions) error{config.WithRegion(region)}
|
||||
if accessKey != "" || secretKey != "" {
|
||||
if accessKey == "" || secretKey == "" {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/utils"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
)
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types/interfaces"
|
||||
"academy/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
|
||||
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
|
||||
|
||||
Reference in new issue
Block a user