From acaee948581976a68d71cf4593b743ad8453bdd3 Mon Sep 17 00:00:00 2001 From: Yvan <8574526@qq,com> Date: Mon, 24 Aug 2026 13:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 5 +- CLAUDE.md | 5 +- Makefile | 6 - README.md | 9 +- buf.gen.config.yaml | 8 - buf.yaml | 1 - cmd/wire_gen.go | 30 +- docs/system-structure-audit.md | 15 +- internal/biz/system/infrastructure.go | 2 +- internal/conf/conf.pb.go | 2322 ------------------ internal/conf/conf.proto | 218 -- internal/conf/runtime.go | 128 - internal/conf/runtime_test.go | 41 - internal/data/config_store.go | 1 - internal/data/config_watch.go | 8 +- internal/data/config_watch_test.go | 8 +- internal/data/initialization_backend_test.go | 2 +- internal/data/integration_config_test.go | 27 +- internal/initialize/configuration.go | 192 +- internal/initialize/configuration_test.go | 22 +- usage.txt | 224 -- 21 files changed, 249 insertions(+), 3025 deletions(-) delete mode 100644 buf.gen.config.yaml delete mode 100644 internal/conf/conf.pb.go delete mode 100644 internal/conf/conf.proto delete mode 100644 internal/conf/runtime.go delete mode 100644 internal/conf/runtime_test.go delete mode 100644 usage.txt diff --git a/AGENTS.md b/AGENTS.md index 60d8817..143c95b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,7 +9,8 @@ agents must follow when changing the template. api/// Proto sources and generated stubs. Public contract. cmd// Entrypoint, Wire injector, main.go. configs/ Runtime config (config.yaml). No secrets. -internal/conf/ Config proto; generated by `make config`. +internal/config/ Viper config models, loading, snapshots, and reloads. +internal/global/ Process-wide shared resource registry. internal/server/ HTTP/gRPC server wiring. internal/service/ Transport adapters; one file per resource. internal/biz/ Domain models, usecases, repo interfaces, errors. @@ -129,7 +130,7 @@ tests exercise repo implementations at the storage boundary. ## Generation & generated files -Regenerate via `make api`, `make config`, or `make all`; never hand-edit +Regenerate via `make api` or `make all`; never hand-edit `*.pb.go`, `*_grpc.pb.go`, `*_http.pb.go`, or `wire_gen.go`. ## Naming & error reasons diff --git a/CLAUDE.md b/CLAUDE.md index c198cb1..ce46cda 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,7 +9,8 @@ agents must follow when changing the template. api/// Proto sources and generated stubs. Public contract. cmd// Entrypoint, Wire injector, main.go. configs/ Runtime config (config.yaml). No secrets. -internal/conf/ Config proto; generated by `make config`. +internal/config/ Viper config models, loading, snapshots, and reloads. +internal/global/ Process-wide shared resource registry. internal/server/ HTTP/gRPC server wiring. internal/service/ Transport adapters; one file per resource. internal/biz/ Domain models, usecases, repo interfaces, errors. @@ -120,7 +121,7 @@ tests exercise repo implementations at the storage boundary. ## Generation & generated files -Regenerate via `make api`, `make config`, or `make all`; never hand-edit +Regenerate via `make api` or `make all`; never hand-edit `*.pb.go`, `*_grpc.pb.go`, `*_http.pb.go`, or `wire_gen.go`. ## Naming & error reasons diff --git a/Makefile b/Makefile index a1404f5..d108ed4 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,6 @@ init: go install github.com/google/wire/cmd/wire@latest go install github.com/bufbuild/buf/cmd/buf@latest -.PHONY: config -# generate internal proto -config: - buf generate --template buf.gen.config.yaml - .PHONY: api # generate api proto api: @@ -33,7 +28,6 @@ generate: # generate all all: make api - make config make generate # show help diff --git a/README.md b/README.md index 196f246..b45968c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,10 @@ Kra 是基于 Kratos 生命周期与 Wire 依赖注入、使用 Gin 提供管理 cmd/ 服务入口与 Wire configs/ 运行配置 internal/biz/ 领域对象、用例和仓储接口(按 system/payment/integration/task 拆分) +internal/config/ Viper 配置模型、加载和热更新 internal/data/ 数据库、缓存、对象存储及仓储实现 +internal/global/ 进程级共享资源入口 +internal/initialize/ 首次安装、配置保存和重载编排 internal/server/ Gin 服务、路由、中间件和 Handler internal/service/ 按业务模块组织的 HTTP 输入输出与领域对象转换 internal/worker/ 定时任务调度与后台工作进程 @@ -39,12 +42,6 @@ pnpm dev ## 生成代码 -修改 `internal/conf/conf.proto` 后执行: - -```shell -make config -``` - 修改 Wire Provider 或构造函数后执行: ```shell diff --git a/buf.gen.config.yaml b/buf.gen.config.yaml deleted file mode 100644 index d74c04f..0000000 --- a/buf.gen.config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -version: v2 -inputs: - - directory: internal -plugins: - - local: ["go", "run", "google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11"] - out: internal - opt: paths=source_relative - diff --git a/buf.yaml b/buf.yaml index 38023b9..e222284 100644 --- a/buf.yaml +++ b/buf.yaml @@ -1,6 +1,5 @@ version: v2 modules: - path: api - - path: internal deps: - buf.build/googleapis/googleapis diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go index 2db14d6..7117174 100644 --- a/cmd/wire_gen.go +++ b/cmd/wire_gen.go @@ -13,7 +13,7 @@ import ( payment2 "kra/internal/biz/payment" system2 "kra/internal/biz/system" task2 "kra/internal/biz/task" - "kra/internal/conf" + "kra/internal/config" "kra/internal/data" "kra/internal/data/integration" "kra/internal/data/payment" @@ -46,13 +46,13 @@ import ( // Injectors from wire.go: // wireApp init kratos application. -func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger, reloadableLogger *logging.ReloadableLogger, string2 string) (*kratos.App, func(), error) { - reloadable, err := storage.NewFileStorage(runtime) +func wireApp(configServer *config.Server, store *config.Store, logger *slog.Logger, reloadableLogger *logging.ReloadableLogger, string2 string) (*kratos.App, func(), error) { + reloadable, err := storage.NewFileStorage(store) if err != nil { return nil, nil, err } catalog := modules.Catalog() - dataData, cleanup, err := data.NewData(runtime, logger, reloadable, catalog) + dataData, cleanup, err := data.NewData(store, logger, reloadable, catalog) if err != nil { return nil, nil, err } @@ -64,7 +64,7 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger userUsecase := system2.NewUserUsecase(userRepo) securityRepo := system.NewSecurityRepo(dataData) systemCache := cache.New(dataData) - runtimeSettings := system.NewRuntimeSettings(runtime) + runtimeSettings := system.NewRuntimeSettings(store) apiTokenRepo := system.NewAPITokenRepo(dataData) tokenUsecase := system2.NewTokenUsecase(apiTokenRepo) securityUsecase := system2.NewSecurityUsecase(securityRepo, systemCache, runtimeSettings, tokenUsecase) @@ -100,7 +100,7 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger announcementUsecase := system2.NewAnnouncementUsecase(announcementRepo) v10 := system3.NewAnnouncementService(announcementUsecase) announcement := handler.NewAnnouncement(v10) - emailRepo := email.NewEmailRepo(runtime) + emailRepo := email.NewEmailRepo(store) emailUsecase := system2.NewEmailUsecase(emailRepo) v11 := system3.NewEmailService(emailUsecase) handlerEmail := handler.NewEmail(v11) @@ -159,8 +159,8 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger navigation := handler.NewNavigation(v23) session := handler.NewSession(v21) integrationConfigRepo := integration.NewIntegrationConfigRepo(dataData) - store := data.NewIntegrationRuntime(dataData) - connectivityTester := integration2.NewConnectivityTester(store) + runtimeconfigStore := data.NewIntegrationRuntime(dataData) + connectivityTester := integration2.NewConnectivityTester(runtimeconfigStore) integrationConfigUsecase := integration3.NewIntegrationConfigUsecase(integrationConfigRepo, connectivityTester) v24 := integration4.NewIntegrationConfigService(integrationConfigUsecase) integrationConfig := handler.NewIntegrationConfig(v24) @@ -168,17 +168,17 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger routes := router.NewRoutes(v25) maintenanceRepo := system.NewMaintenanceRepo(dataData) maintenanceUsecase := system2.NewMaintenanceUsecase(maintenanceRepo) - taskMethods := worker.NewTaskMethods(taskUsecase, maintenanceUsecase, mediaUsecase, runtime) - appRuntimeContributions := runtimeContributions(routes, taskMethods) - moduleRuntime := app.Runtime(appRuntimeContributions, registry) - websocketServer, cleanup2, err := websocket.New(store) + taskMethods := worker.NewTaskMethods(taskUsecase, maintenanceUsecase, mediaUsecase, store) + composition := runtimeContributions(routes, taskMethods) + runtime := app.Build(composition, registry) + websocketServer, cleanup2, err := websocket.New(runtimeconfigStore) if err != nil { cleanup() return nil, nil, err } - engine := server.NewGinEngineWithRuntime(runtime, v, authService, v2, v3, logger, string2, moduleRuntime, websocketServer) - httpServer := server.NewGinServer(confServer, engine) - mqReloadable, cleanup3, err := mq.New(store, logger) + engine := server.NewGinEngineWithRuntime(store, v, authService, v2, v3, logger, string2, runtime, websocketServer) + httpServer := server.NewGinServer(configServer, engine) + mqReloadable, cleanup3, err := mq.New(runtimeconfigStore, logger) if err != nil { cleanup2() cleanup() diff --git a/docs/system-structure-audit.md b/docs/system-structure-audit.md index 927a976..9832817 100644 --- a/docs/system-structure-audit.md +++ b/docs/system-structure-audit.md @@ -1,7 +1,7 @@ # `internal` 目录结构优化结论 -参考 Go Kratos 的分层方式,顶层保留 `app`、`modules`、`biz`、`conf`、`data`、 -`initialize`、`integration`、`security`、`server`、`service`、`worker` 十个 +参考 Go Kratos 的分层方式,顶层保留 `app`、`modules`、`biz`、`config`、`global`、 +`data`、`initialize`、`integration`、`security`、`server`、`service`、`worker` 等 稳定职责。目录不是越少越好:同一技术角色文件较多时,应在所属层下分组,避免 一个目录堆积几十个文件。 @@ -9,11 +9,12 @@ ```text internal/ - app/ # 运行时组合根 + app/ # 应用组合根 modules/ # 静态 catalog 和模块定义 modules/payment/ # payment 模块定义 biz/ # DO、usecase、repo interface - conf/ # 配置 proto/runtime + config/ # Viper 配置、快照和热更新 + global/ # 进程级共享资源 data/ # PO、repo、数据库和迁移 initialize/ # 首次安装和配置编排 integration/ # 外部 I/O provider @@ -40,15 +41,15 @@ internal/ 独立边界时不继续拆分。 - 删除只转发 `pkg/protoutil` 的 `utils/configutil`。 -## `internal/app` 为什么只保留运行时组合 +## `internal/app` 为什么只保留应用组合 `modules/catalog.go` 是静态模块注册点,负责按依赖顺序汇总各模块 -`Definition()`;`app/runtime.go` 只负责任务注册和依赖注入后的运行时路由组合。 +`Definition()`;`app/runtime.go` 只负责任务注册和依赖注入后的路由组合。 这样模块定义不再和应用组合逻辑混在一起,也不能误并入 `biz`、`service` 或 `data`。 Catalog 只能自动汇总静态模块贡献;新增模块若提供运行时路由或依赖型任务,仍需 -在 cmd/Wire 中显式注册,直到统一的 runtime contribution 协议落地。 +在 cmd/Wire 中显式注册。 ## 其他目录审查 diff --git a/internal/biz/system/infrastructure.go b/internal/biz/system/infrastructure.go index 6537734..8aca735 100644 --- a/internal/biz/system/infrastructure.go +++ b/internal/biz/system/infrastructure.go @@ -65,7 +65,7 @@ func (s MediaSettings) EffectiveMaxFileSize() int64 { } // RuntimeSettings exposes only the active values needed by the application. -// The data implementation resolves every call from conf.Runtime so hot reloads +// The data implementation resolves every call from config.Store so hot reloads // take effect without rebuilding services. type RuntimeSettings interface { RouterPrefix() string diff --git a/internal/conf/conf.pb.go b/internal/conf/conf.pb.go deleted file mode 100644 index 8cdf000..0000000 --- a/internal/conf/conf.pb.go +++ /dev/null @@ -1,2322 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v5.28.3 -// source: conf/conf.proto - -package conf - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Bootstrap struct { - state protoimpl.MessageState `protogen:"open.v1"` - Server *Server `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"` - Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - Admin *AdminBackend `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Bootstrap) Reset() { - *x = Bootstrap{} - mi := &file_conf_conf_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Bootstrap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Bootstrap) ProtoMessage() {} - -func (x *Bootstrap) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Bootstrap.ProtoReflect.Descriptor instead. -func (*Bootstrap) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{0} -} - -func (x *Bootstrap) GetServer() *Server { - if x != nil { - return x.Server - } - return nil -} - -func (x *Bootstrap) GetData() *Data { - if x != nil { - return x.Data - } - return nil -} - -func (x *Bootstrap) GetAdmin() *AdminBackend { - if x != nil { - return x.Admin - } - return nil -} - -type Server struct { - state protoimpl.MessageState `protogen:"open.v1"` - Http *Server_HTTP `protobuf:"bytes,1,opt,name=http,proto3" json:"http,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Server) Reset() { - *x = Server{} - mi := &file_conf_conf_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Server) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Server) ProtoMessage() {} - -func (x *Server) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Server.ProtoReflect.Descriptor instead. -func (*Server) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{1} -} - -func (x *Server) GetHttp() *Server_HTTP { - if x != nil { - return x.Http - } - return nil -} - -type Data struct { - state protoimpl.MessageState `protogen:"open.v1"` - Database *Data_Database `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"` - Redis *Data_Redis `protobuf:"bytes,2,opt,name=redis,proto3" json:"redis,omitempty"` - DatabaseList []*Data_Database `protobuf:"bytes,3,rep,name=database_list,json=databaseList,proto3" json:"database_list,omitempty"` - RedisList []*Data_Redis `protobuf:"bytes,4,rep,name=redis_list,json=redisList,proto3" json:"redis_list,omitempty"` - Mongo *Data_Mongo `protobuf:"bytes,5,opt,name=mongo,proto3" json:"mongo,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data) Reset() { - *x = Data{} - mi := &file_conf_conf_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data) ProtoMessage() {} - -func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data.ProtoReflect.Descriptor instead. -func (*Data) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{2} -} - -func (x *Data) GetDatabase() *Data_Database { - if x != nil { - return x.Database - } - return nil -} - -func (x *Data) GetRedis() *Data_Redis { - if x != nil { - return x.Redis - } - return nil -} - -func (x *Data) GetDatabaseList() []*Data_Database { - if x != nil { - return x.DatabaseList - } - return nil -} - -func (x *Data) GetRedisList() []*Data_Redis { - if x != nil { - return x.RedisList - } - return nil -} - -func (x *Data) GetMongo() *Data_Mongo { - if x != nil { - return x.Mongo - } - return nil -} - -// AdminBackend contains settings for the administration HTTP transport. -type AdminBackend struct { - state protoimpl.MessageState `protogen:"open.v1"` - RouterPrefix string `protobuf:"bytes,1,opt,name=router_prefix,json=routerPrefix,proto3" json:"router_prefix,omitempty"` - Jwt *AdminBackend_JWT `protobuf:"bytes,2,opt,name=jwt,proto3" json:"jwt,omitempty"` - Captcha *AdminBackend_Captcha `protobuf:"bytes,3,opt,name=captcha,proto3" json:"captcha,omitempty"` - Local *AdminBackend_Local `protobuf:"bytes,4,opt,name=local,proto3" json:"local,omitempty"` - Email *AdminBackend_Email `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` - Storage *AdminBackend_Storage `protobuf:"bytes,6,opt,name=storage,proto3" json:"storage,omitempty"` - // ConfigPath is populated by the entrypoint and is not required in YAML. - ConfigPath string `protobuf:"bytes,7,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"` - Media *AdminBackend_Media `protobuf:"bytes,8,opt,name=media,proto3" json:"media,omitempty"` - DiskList []*AdminBackend_Disk `protobuf:"bytes,9,rep,name=disk_list,json=diskList,proto3" json:"disk_list,omitempty"` - System *AdminBackend_System `protobuf:"bytes,10,opt,name=system,proto3" json:"system,omitempty"` - Zap *AdminBackend_Zap `protobuf:"bytes,11,opt,name=zap,proto3" json:"zap,omitempty"` - Cors *AdminBackend_CORS `protobuf:"bytes,12,opt,name=cors,proto3" json:"cors,omitempty"` - App *AdminBackend_App `protobuf:"bytes,13,opt,name=app,proto3" json:"app,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend) Reset() { - *x = AdminBackend{} - mi := &file_conf_conf_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend) ProtoMessage() {} - -func (x *AdminBackend) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend.ProtoReflect.Descriptor instead. -func (*AdminBackend) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3} -} - -func (x *AdminBackend) GetRouterPrefix() string { - if x != nil { - return x.RouterPrefix - } - return "" -} - -func (x *AdminBackend) GetJwt() *AdminBackend_JWT { - if x != nil { - return x.Jwt - } - return nil -} - -func (x *AdminBackend) GetCaptcha() *AdminBackend_Captcha { - if x != nil { - return x.Captcha - } - return nil -} - -func (x *AdminBackend) GetLocal() *AdminBackend_Local { - if x != nil { - return x.Local - } - return nil -} - -func (x *AdminBackend) GetEmail() *AdminBackend_Email { - if x != nil { - return x.Email - } - return nil -} - -func (x *AdminBackend) GetStorage() *AdminBackend_Storage { - if x != nil { - return x.Storage - } - return nil -} - -func (x *AdminBackend) GetConfigPath() string { - if x != nil { - return x.ConfigPath - } - return "" -} - -func (x *AdminBackend) GetMedia() *AdminBackend_Media { - if x != nil { - return x.Media - } - return nil -} - -func (x *AdminBackend) GetDiskList() []*AdminBackend_Disk { - if x != nil { - return x.DiskList - } - return nil -} - -func (x *AdminBackend) GetSystem() *AdminBackend_System { - if x != nil { - return x.System - } - return nil -} - -func (x *AdminBackend) GetZap() *AdminBackend_Zap { - if x != nil { - return x.Zap - } - return nil -} - -func (x *AdminBackend) GetCors() *AdminBackend_CORS { - if x != nil { - return x.Cors - } - return nil -} - -func (x *AdminBackend) GetApp() *AdminBackend_App { - if x != nil { - return x.App - } - return nil -} - -type Server_HTTP struct { - state protoimpl.MessageState `protogen:"open.v1"` - Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` - Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Server_HTTP) Reset() { - *x = Server_HTTP{} - mi := &file_conf_conf_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Server_HTTP) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Server_HTTP) ProtoMessage() {} - -func (x *Server_HTTP) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Server_HTTP.ProtoReflect.Descriptor instead. -func (*Server_HTTP) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Server_HTTP) GetNetwork() string { - if x != nil { - return x.Network - } - return "" -} - -func (x *Server_HTTP) GetAddr() string { - if x != nil { - return x.Addr - } - return "" -} - -func (x *Server_HTTP) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -type Data_Database struct { - state protoimpl.MessageState `protogen:"open.v1"` - Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"` - Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - Port string `protobuf:"bytes,4,opt,name=port,proto3" json:"port,omitempty"` - User string `protobuf:"bytes,5,opt,name=user,proto3" json:"user,omitempty"` - Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"` - Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"` - Config string `protobuf:"bytes,8,opt,name=config,proto3" json:"config,omitempty"` - Path string `protobuf:"bytes,9,opt,name=path,proto3" json:"path,omitempty"` - AliasName string `protobuf:"bytes,10,opt,name=alias_name,json=aliasName,proto3" json:"alias_name,omitempty"` - Disable bool `protobuf:"varint,11,opt,name=disable,proto3" json:"disable,omitempty"` - Prefix string `protobuf:"bytes,12,opt,name=prefix,proto3" json:"prefix,omitempty"` - Engine string `protobuf:"bytes,13,opt,name=engine,proto3" json:"engine,omitempty"` - LogMode string `protobuf:"bytes,14,opt,name=log_mode,json=logMode,proto3" json:"log_mode,omitempty"` - MaxIdleConns int32 `protobuf:"varint,15,opt,name=max_idle_conns,json=maxIdleConns,proto3" json:"max_idle_conns,omitempty"` - MaxOpenConns int32 `protobuf:"varint,16,opt,name=max_open_conns,json=maxOpenConns,proto3" json:"max_open_conns,omitempty"` - ConnMaxLifetime int32 `protobuf:"varint,17,opt,name=conn_max_lifetime,json=connMaxLifetime,proto3" json:"conn_max_lifetime,omitempty"` - Singular bool `protobuf:"varint,18,opt,name=singular,proto3" json:"singular,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data_Database) Reset() { - *x = Data_Database{} - mi := &file_conf_conf_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data_Database) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data_Database) ProtoMessage() {} - -func (x *Data_Database) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data_Database.ProtoReflect.Descriptor instead. -func (*Data_Database) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *Data_Database) GetDriver() string { - if x != nil { - return x.Driver - } - return "" -} - -func (x *Data_Database) GetSource() string { - if x != nil { - return x.Source - } - return "" -} - -func (x *Data_Database) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *Data_Database) GetPort() string { - if x != nil { - return x.Port - } - return "" -} - -func (x *Data_Database) GetUser() string { - if x != nil { - return x.User - } - return "" -} - -func (x *Data_Database) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *Data_Database) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Data_Database) GetConfig() string { - if x != nil { - return x.Config - } - return "" -} - -func (x *Data_Database) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *Data_Database) GetAliasName() string { - if x != nil { - return x.AliasName - } - return "" -} - -func (x *Data_Database) GetDisable() bool { - if x != nil { - return x.Disable - } - return false -} - -func (x *Data_Database) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *Data_Database) GetEngine() string { - if x != nil { - return x.Engine - } - return "" -} - -func (x *Data_Database) GetLogMode() string { - if x != nil { - return x.LogMode - } - return "" -} - -func (x *Data_Database) GetMaxIdleConns() int32 { - if x != nil { - return x.MaxIdleConns - } - return 0 -} - -func (x *Data_Database) GetMaxOpenConns() int32 { - if x != nil { - return x.MaxOpenConns - } - return 0 -} - -func (x *Data_Database) GetConnMaxLifetime() int32 { - if x != nil { - return x.ConnMaxLifetime - } - return 0 -} - -func (x *Data_Database) GetSingular() bool { - if x != nil { - return x.Singular - } - return false -} - -type Data_Redis struct { - state protoimpl.MessageState `protogen:"open.v1"` - Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` - Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - ReadTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` - WriteTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"` - Db int32 `protobuf:"varint,7,opt,name=db,proto3" json:"db,omitempty"` - UseCluster bool `protobuf:"varint,8,opt,name=use_cluster,json=useCluster,proto3" json:"use_cluster,omitempty"` - ClusterAddrs []string `protobuf:"bytes,9,rep,name=cluster_addrs,json=clusterAddrs,proto3" json:"cluster_addrs,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data_Redis) Reset() { - *x = Data_Redis{} - mi := &file_conf_conf_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data_Redis) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data_Redis) ProtoMessage() {} - -func (x *Data_Redis) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data_Redis.ProtoReflect.Descriptor instead. -func (*Data_Redis) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{2, 1} -} - -func (x *Data_Redis) GetNetwork() string { - if x != nil { - return x.Network - } - return "" -} - -func (x *Data_Redis) GetAddr() string { - if x != nil { - return x.Addr - } - return "" -} - -func (x *Data_Redis) GetReadTimeout() *durationpb.Duration { - if x != nil { - return x.ReadTimeout - } - return nil -} - -func (x *Data_Redis) GetWriteTimeout() *durationpb.Duration { - if x != nil { - return x.WriteTimeout - } - return nil -} - -func (x *Data_Redis) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Data_Redis) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *Data_Redis) GetDb() int32 { - if x != nil { - return x.Db - } - return 0 -} - -func (x *Data_Redis) GetUseCluster() bool { - if x != nil { - return x.UseCluster - } - return false -} - -func (x *Data_Redis) GetClusterAddrs() []string { - if x != nil { - return x.ClusterAddrs - } - return nil -} - -type Data_MongoHost struct { - state protoimpl.MessageState `protogen:"open.v1"` - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Port string `protobuf:"bytes,2,opt,name=port,proto3" json:"port,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data_MongoHost) Reset() { - *x = Data_MongoHost{} - mi := &file_conf_conf_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data_MongoHost) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data_MongoHost) ProtoMessage() {} - -func (x *Data_MongoHost) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data_MongoHost.ProtoReflect.Descriptor instead. -func (*Data_MongoHost) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{2, 2} -} - -func (x *Data_MongoHost) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *Data_MongoHost) GetPort() string { - if x != nil { - return x.Port - } - return "" -} - -type Data_Mongo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Coll string `protobuf:"bytes,1,opt,name=coll,proto3" json:"coll,omitempty"` - Options string `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` - Database string `protobuf:"bytes,3,opt,name=database,proto3" json:"database,omitempty"` - Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` - Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` - AuthSource string `protobuf:"bytes,6,opt,name=auth_source,json=authSource,proto3" json:"auth_source,omitempty"` - MinPoolSize uint64 `protobuf:"varint,7,opt,name=min_pool_size,json=minPoolSize,proto3" json:"min_pool_size,omitempty"` - MaxPoolSize uint64 `protobuf:"varint,8,opt,name=max_pool_size,json=maxPoolSize,proto3" json:"max_pool_size,omitempty"` - SocketTimeoutMs int64 `protobuf:"varint,9,opt,name=socket_timeout_ms,json=socketTimeoutMs,proto3" json:"socket_timeout_ms,omitempty"` - ConnectTimeoutMs int64 `protobuf:"varint,10,opt,name=connect_timeout_ms,json=connectTimeoutMs,proto3" json:"connect_timeout_ms,omitempty"` - IsZap bool `protobuf:"varint,11,opt,name=is_zap,json=isZap,proto3" json:"is_zap,omitempty"` - Hosts []*Data_MongoHost `protobuf:"bytes,12,rep,name=hosts,proto3" json:"hosts,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data_Mongo) Reset() { - *x = Data_Mongo{} - mi := &file_conf_conf_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data_Mongo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data_Mongo) ProtoMessage() {} - -func (x *Data_Mongo) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data_Mongo.ProtoReflect.Descriptor instead. -func (*Data_Mongo) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{2, 3} -} - -func (x *Data_Mongo) GetColl() string { - if x != nil { - return x.Coll - } - return "" -} - -func (x *Data_Mongo) GetOptions() string { - if x != nil { - return x.Options - } - return "" -} - -func (x *Data_Mongo) GetDatabase() string { - if x != nil { - return x.Database - } - return "" -} - -func (x *Data_Mongo) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *Data_Mongo) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *Data_Mongo) GetAuthSource() string { - if x != nil { - return x.AuthSource - } - return "" -} - -func (x *Data_Mongo) GetMinPoolSize() uint64 { - if x != nil { - return x.MinPoolSize - } - return 0 -} - -func (x *Data_Mongo) GetMaxPoolSize() uint64 { - if x != nil { - return x.MaxPoolSize - } - return 0 -} - -func (x *Data_Mongo) GetSocketTimeoutMs() int64 { - if x != nil { - return x.SocketTimeoutMs - } - return 0 -} - -func (x *Data_Mongo) GetConnectTimeoutMs() int64 { - if x != nil { - return x.ConnectTimeoutMs - } - return 0 -} - -func (x *Data_Mongo) GetIsZap() bool { - if x != nil { - return x.IsZap - } - return false -} - -func (x *Data_Mongo) GetHosts() []*Data_MongoHost { - if x != nil { - return x.Hosts - } - return nil -} - -type AdminBackend_JWT struct { - state protoimpl.MessageState `protogen:"open.v1"` - SigningKey string `protobuf:"bytes,1,opt,name=signing_key,json=signingKey,proto3" json:"signing_key,omitempty"` - ExpiresTime *durationpb.Duration `protobuf:"bytes,2,opt,name=expires_time,json=expiresTime,proto3" json:"expires_time,omitempty"` - BufferTime *durationpb.Duration `protobuf:"bytes,3,opt,name=buffer_time,json=bufferTime,proto3" json:"buffer_time,omitempty"` - Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_JWT) Reset() { - *x = AdminBackend_JWT{} - mi := &file_conf_conf_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_JWT) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_JWT) ProtoMessage() {} - -func (x *AdminBackend_JWT) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_JWT.ProtoReflect.Descriptor instead. -func (*AdminBackend_JWT) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *AdminBackend_JWT) GetSigningKey() string { - if x != nil { - return x.SigningKey - } - return "" -} - -func (x *AdminBackend_JWT) GetExpiresTime() *durationpb.Duration { - if x != nil { - return x.ExpiresTime - } - return nil -} - -func (x *AdminBackend_JWT) GetBufferTime() *durationpb.Duration { - if x != nil { - return x.BufferTime - } - return nil -} - -func (x *AdminBackend_JWT) GetIssuer() string { - if x != nil { - return x.Issuer - } - return "" -} - -type AdminBackend_Captcha struct { - state protoimpl.MessageState `protogen:"open.v1"` - KeyLong int32 `protobuf:"varint,1,opt,name=key_long,json=keyLong,proto3" json:"key_long,omitempty"` - ImgWidth int32 `protobuf:"varint,2,opt,name=img_width,json=imgWidth,proto3" json:"img_width,omitempty"` - ImgHeight int32 `protobuf:"varint,3,opt,name=img_height,json=imgHeight,proto3" json:"img_height,omitempty"` - StoreExpiration *durationpb.Duration `protobuf:"bytes,4,opt,name=store_expiration,json=storeExpiration,proto3" json:"store_expiration,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Captcha) Reset() { - *x = AdminBackend_Captcha{} - mi := &file_conf_conf_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Captcha) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Captcha) ProtoMessage() {} - -func (x *AdminBackend_Captcha) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Captcha.ProtoReflect.Descriptor instead. -func (*AdminBackend_Captcha) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 1} -} - -func (x *AdminBackend_Captcha) GetKeyLong() int32 { - if x != nil { - return x.KeyLong - } - return 0 -} - -func (x *AdminBackend_Captcha) GetImgWidth() int32 { - if x != nil { - return x.ImgWidth - } - return 0 -} - -func (x *AdminBackend_Captcha) GetImgHeight() int32 { - if x != nil { - return x.ImgHeight - } - return 0 -} - -func (x *AdminBackend_Captcha) GetStoreExpiration() *durationpb.Duration { - if x != nil { - return x.StoreExpiration - } - return nil -} - -type AdminBackend_Local struct { - state protoimpl.MessageState `protogen:"open.v1"` - StorePath string `protobuf:"bytes,1,opt,name=store_path,json=storePath,proto3" json:"store_path,omitempty"` - PathPrefix string `protobuf:"bytes,2,opt,name=path_prefix,json=pathPrefix,proto3" json:"path_prefix,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Local) Reset() { - *x = AdminBackend_Local{} - mi := &file_conf_conf_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Local) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Local) ProtoMessage() {} - -func (x *AdminBackend_Local) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Local.ProtoReflect.Descriptor instead. -func (*AdminBackend_Local) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 2} -} - -func (x *AdminBackend_Local) GetStorePath() string { - if x != nil { - return x.StorePath - } - return "" -} - -func (x *AdminBackend_Local) GetPathPrefix() string { - if x != nil { - return x.PathPrefix - } - return "" -} - -type AdminBackend_Email struct { - state protoimpl.MessageState `protogen:"open.v1"` - To string `protobuf:"bytes,1,opt,name=to,proto3" json:"to,omitempty"` - From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - Secret string `protobuf:"bytes,4,opt,name=secret,proto3" json:"secret,omitempty"` - Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname,omitempty"` - Port int32 `protobuf:"varint,6,opt,name=port,proto3" json:"port,omitempty"` - IsSsl bool `protobuf:"varint,7,opt,name=is_ssl,json=isSsl,proto3" json:"is_ssl,omitempty"` - IsLoginAuth bool `protobuf:"varint,8,opt,name=is_login_auth,json=isLoginAuth,proto3" json:"is_login_auth,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Email) Reset() { - *x = AdminBackend_Email{} - mi := &file_conf_conf_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Email) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Email) ProtoMessage() {} - -func (x *AdminBackend_Email) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Email.ProtoReflect.Descriptor instead. -func (*AdminBackend_Email) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 3} -} - -func (x *AdminBackend_Email) GetTo() string { - if x != nil { - return x.To - } - return "" -} - -func (x *AdminBackend_Email) GetFrom() string { - if x != nil { - return x.From - } - return "" -} - -func (x *AdminBackend_Email) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *AdminBackend_Email) GetSecret() string { - if x != nil { - return x.Secret - } - return "" -} - -func (x *AdminBackend_Email) GetNickname() string { - if x != nil { - return x.Nickname - } - return "" -} - -func (x *AdminBackend_Email) GetPort() int32 { - if x != nil { - return x.Port - } - return 0 -} - -func (x *AdminBackend_Email) GetIsSsl() bool { - if x != nil { - return x.IsSsl - } - return false -} - -func (x *AdminBackend_Email) GetIsLoginAuth() bool { - if x != nil { - return x.IsLoginAuth - } - return false -} - -type AdminBackend_Media struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionTtl int32 `protobuf:"varint,1,opt,name=session_ttl,json=sessionTtl,proto3" json:"session_ttl,omitempty"` - MaxFileSize int64 `protobuf:"varint,2,opt,name=max_file_size,json=maxFileSize,proto3" json:"max_file_size,omitempty"` - ChunkDir string `protobuf:"bytes,3,opt,name=chunk_dir,json=chunkDir,proto3" json:"chunk_dir,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Media) Reset() { - *x = AdminBackend_Media{} - mi := &file_conf_conf_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Media) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Media) ProtoMessage() {} - -func (x *AdminBackend_Media) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Media.ProtoReflect.Descriptor instead. -func (*AdminBackend_Media) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 4} -} - -func (x *AdminBackend_Media) GetSessionTtl() int32 { - if x != nil { - return x.SessionTtl - } - return 0 -} - -func (x *AdminBackend_Media) GetMaxFileSize() int64 { - if x != nil { - return x.MaxFileSize - } - return 0 -} - -func (x *AdminBackend_Media) GetChunkDir() string { - if x != nil { - return x.ChunkDir - } - return "" -} - -type AdminBackend_Disk struct { - state protoimpl.MessageState `protogen:"open.v1"` - MountPoint string `protobuf:"bytes,1,opt,name=mount_point,json=mountPoint,proto3" json:"mount_point,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Disk) Reset() { - *x = AdminBackend_Disk{} - mi := &file_conf_conf_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Disk) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Disk) ProtoMessage() {} - -func (x *AdminBackend_Disk) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Disk.ProtoReflect.Descriptor instead. -func (*AdminBackend_Disk) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 5} -} - -func (x *AdminBackend_Disk) GetMountPoint() string { - if x != nil { - return x.MountPoint - } - return "" -} - -type AdminBackend_System struct { - state protoimpl.MessageState `protogen:"open.v1"` - UseRedis bool `protobuf:"varint,1,opt,name=use_redis,json=useRedis,proto3" json:"use_redis,omitempty"` - UseMultipoint bool `protobuf:"varint,2,opt,name=use_multipoint,json=useMultipoint,proto3" json:"use_multipoint,omitempty"` - UseStrictAuth bool `protobuf:"varint,3,opt,name=use_strict_auth,json=useStrictAuth,proto3" json:"use_strict_auth,omitempty"` - DisableAutoMigrate bool `protobuf:"varint,4,opt,name=disable_auto_migrate,json=disableAutoMigrate,proto3" json:"disable_auto_migrate,omitempty"` - UseMongo bool `protobuf:"varint,5,opt,name=use_mongo,json=useMongo,proto3" json:"use_mongo,omitempty"` - Addr int32 `protobuf:"varint,6,opt,name=addr,proto3" json:"addr,omitempty"` - IplimitCount int32 `protobuf:"varint,7,opt,name=iplimit_count,json=iplimitCount,proto3" json:"iplimit_count,omitempty"` - IplimitTime int32 `protobuf:"varint,8,opt,name=iplimit_time,json=iplimitTime,proto3" json:"iplimit_time,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_System) Reset() { - *x = AdminBackend_System{} - mi := &file_conf_conf_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_System) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_System) ProtoMessage() {} - -func (x *AdminBackend_System) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_System.ProtoReflect.Descriptor instead. -func (*AdminBackend_System) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 6} -} - -func (x *AdminBackend_System) GetUseRedis() bool { - if x != nil { - return x.UseRedis - } - return false -} - -func (x *AdminBackend_System) GetUseMultipoint() bool { - if x != nil { - return x.UseMultipoint - } - return false -} - -func (x *AdminBackend_System) GetUseStrictAuth() bool { - if x != nil { - return x.UseStrictAuth - } - return false -} - -func (x *AdminBackend_System) GetDisableAutoMigrate() bool { - if x != nil { - return x.DisableAutoMigrate - } - return false -} - -func (x *AdminBackend_System) GetUseMongo() bool { - if x != nil { - return x.UseMongo - } - return false -} - -func (x *AdminBackend_System) GetAddr() int32 { - if x != nil { - return x.Addr - } - return 0 -} - -func (x *AdminBackend_System) GetIplimitCount() int32 { - if x != nil { - return x.IplimitCount - } - return 0 -} - -func (x *AdminBackend_System) GetIplimitTime() int32 { - if x != nil { - return x.IplimitTime - } - return 0 -} - -type AdminBackend_Zap struct { - state protoimpl.MessageState `protogen:"open.v1"` - Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"` - Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` - Format string `protobuf:"bytes,3,opt,name=format,proto3" json:"format,omitempty"` - Director string `protobuf:"bytes,4,opt,name=director,proto3" json:"director,omitempty"` - EncodeLevel string `protobuf:"bytes,5,opt,name=encode_level,json=encodeLevel,proto3" json:"encode_level,omitempty"` - StacktraceKey string `protobuf:"bytes,6,opt,name=stacktrace_key,json=stacktraceKey,proto3" json:"stacktrace_key,omitempty"` - ShowLine bool `protobuf:"varint,7,opt,name=show_line,json=showLine,proto3" json:"show_line,omitempty"` - LogInConsole bool `protobuf:"varint,8,opt,name=log_in_console,json=logInConsole,proto3" json:"log_in_console,omitempty"` - RetentionDay int32 `protobuf:"varint,9,opt,name=retention_day,json=retentionDay,proto3" json:"retention_day,omitempty"` - AccessReqBody bool `protobuf:"varint,10,opt,name=access_req_body,json=accessReqBody,proto3" json:"access_req_body,omitempty"` - AccessRespData bool `protobuf:"varint,11,opt,name=access_resp_data,json=accessRespData,proto3" json:"access_resp_data,omitempty"` - AccessReqHeaders bool `protobuf:"varint,12,opt,name=access_req_headers,json=accessReqHeaders,proto3" json:"access_req_headers,omitempty"` - AccessLogMaxBytes int32 `protobuf:"varint,13,opt,name=access_log_max_bytes,json=accessLogMaxBytes,proto3" json:"access_log_max_bytes,omitempty"` - FileOnlyModules []string `protobuf:"bytes,14,rep,name=file_only_modules,json=fileOnlyModules,proto3" json:"file_only_modules,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Zap) Reset() { - *x = AdminBackend_Zap{} - mi := &file_conf_conf_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Zap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Zap) ProtoMessage() {} - -func (x *AdminBackend_Zap) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Zap.ProtoReflect.Descriptor instead. -func (*AdminBackend_Zap) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 7} -} - -func (x *AdminBackend_Zap) GetLevel() string { - if x != nil { - return x.Level - } - return "" -} - -func (x *AdminBackend_Zap) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *AdminBackend_Zap) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *AdminBackend_Zap) GetDirector() string { - if x != nil { - return x.Director - } - return "" -} - -func (x *AdminBackend_Zap) GetEncodeLevel() string { - if x != nil { - return x.EncodeLevel - } - return "" -} - -func (x *AdminBackend_Zap) GetStacktraceKey() string { - if x != nil { - return x.StacktraceKey - } - return "" -} - -func (x *AdminBackend_Zap) GetShowLine() bool { - if x != nil { - return x.ShowLine - } - return false -} - -func (x *AdminBackend_Zap) GetLogInConsole() bool { - if x != nil { - return x.LogInConsole - } - return false -} - -func (x *AdminBackend_Zap) GetRetentionDay() int32 { - if x != nil { - return x.RetentionDay - } - return 0 -} - -func (x *AdminBackend_Zap) GetAccessReqBody() bool { - if x != nil { - return x.AccessReqBody - } - return false -} - -func (x *AdminBackend_Zap) GetAccessRespData() bool { - if x != nil { - return x.AccessRespData - } - return false -} - -func (x *AdminBackend_Zap) GetAccessReqHeaders() bool { - if x != nil { - return x.AccessReqHeaders - } - return false -} - -func (x *AdminBackend_Zap) GetAccessLogMaxBytes() int32 { - if x != nil { - return x.AccessLogMaxBytes - } - return 0 -} - -func (x *AdminBackend_Zap) GetFileOnlyModules() []string { - if x != nil { - return x.FileOnlyModules - } - return nil -} - -type AdminBackend_CORS struct { - state protoimpl.MessageState `protogen:"open.v1"` - Mode string `protobuf:"bytes,1,opt,name=mode,proto3" json:"mode,omitempty"` - Whitelist []*AdminBackend_CORSRule `protobuf:"bytes,2,rep,name=whitelist,proto3" json:"whitelist,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_CORS) Reset() { - *x = AdminBackend_CORS{} - mi := &file_conf_conf_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_CORS) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_CORS) ProtoMessage() {} - -func (x *AdminBackend_CORS) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_CORS.ProtoReflect.Descriptor instead. -func (*AdminBackend_CORS) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 8} -} - -func (x *AdminBackend_CORS) GetMode() string { - if x != nil { - return x.Mode - } - return "" -} - -func (x *AdminBackend_CORS) GetWhitelist() []*AdminBackend_CORSRule { - if x != nil { - return x.Whitelist - } - return nil -} - -type AdminBackend_CORSRule struct { - state protoimpl.MessageState `protogen:"open.v1"` - AllowOrigin string `protobuf:"bytes,1,opt,name=allow_origin,json=allowOrigin,proto3" json:"allow_origin,omitempty"` - AllowMethods string `protobuf:"bytes,2,opt,name=allow_methods,json=allowMethods,proto3" json:"allow_methods,omitempty"` - AllowHeaders string `protobuf:"bytes,3,opt,name=allow_headers,json=allowHeaders,proto3" json:"allow_headers,omitempty"` - ExposeHeaders string `protobuf:"bytes,4,opt,name=expose_headers,json=exposeHeaders,proto3" json:"expose_headers,omitempty"` - AllowCredentials bool `protobuf:"varint,5,opt,name=allow_credentials,json=allowCredentials,proto3" json:"allow_credentials,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_CORSRule) Reset() { - *x = AdminBackend_CORSRule{} - mi := &file_conf_conf_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_CORSRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_CORSRule) ProtoMessage() {} - -func (x *AdminBackend_CORSRule) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_CORSRule.ProtoReflect.Descriptor instead. -func (*AdminBackend_CORSRule) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 9} -} - -func (x *AdminBackend_CORSRule) GetAllowOrigin() string { - if x != nil { - return x.AllowOrigin - } - return "" -} - -func (x *AdminBackend_CORSRule) GetAllowMethods() string { - if x != nil { - return x.AllowMethods - } - return "" -} - -func (x *AdminBackend_CORSRule) GetAllowHeaders() string { - if x != nil { - return x.AllowHeaders - } - return "" -} - -func (x *AdminBackend_CORSRule) GetExposeHeaders() string { - if x != nil { - return x.ExposeHeaders - } - return "" -} - -func (x *AdminBackend_CORSRule) GetAllowCredentials() bool { - if x != nil { - return x.AllowCredentials - } - return false -} - -type AdminBackend_App struct { - state protoimpl.MessageState `protogen:"open.v1"` - Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` - AppId string `protobuf:"bytes,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` - Env string `protobuf:"bytes,3,opt,name=env,proto3" json:"env,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_App) Reset() { - *x = AdminBackend_App{} - mi := &file_conf_conf_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_App) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_App) ProtoMessage() {} - -func (x *AdminBackend_App) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_App.ProtoReflect.Descriptor instead. -func (*AdminBackend_App) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 10} -} - -func (x *AdminBackend_App) GetNode() string { - if x != nil { - return x.Node - } - return "" -} - -func (x *AdminBackend_App) GetAppId() string { - if x != nil { - return x.AppId - } - return "" -} - -func (x *AdminBackend_App) GetEnv() string { - if x != nil { - return x.Env - } - return "" -} - -type AdminBackend_Storage struct { - state protoimpl.MessageState `protogen:"open.v1"` - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Qiniu *AdminBackend_Qiniu `protobuf:"bytes,2,opt,name=qiniu,proto3" json:"qiniu,omitempty"` - AliyunOss *AdminBackend_ObjectStore `protobuf:"bytes,3,opt,name=aliyun_oss,json=aliyunOss,proto3" json:"aliyun_oss,omitempty"` - HuaweiObs *AdminBackend_ObjectStore `protobuf:"bytes,4,opt,name=huawei_obs,json=huaweiObs,proto3" json:"huawei_obs,omitempty"` - TencentCos *AdminBackend_ObjectStore `protobuf:"bytes,5,opt,name=tencent_cos,json=tencentCos,proto3" json:"tencent_cos,omitempty"` - AwsS3 *AdminBackend_ObjectStore `protobuf:"bytes,6,opt,name=aws_s3,json=awsS3,proto3" json:"aws_s3,omitempty"` - CloudflareR2 *AdminBackend_ObjectStore `protobuf:"bytes,7,opt,name=cloudflare_r2,json=cloudflareR2,proto3" json:"cloudflare_r2,omitempty"` - Minio *AdminBackend_ObjectStore `protobuf:"bytes,8,opt,name=minio,proto3" json:"minio,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Storage) Reset() { - *x = AdminBackend_Storage{} - mi := &file_conf_conf_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Storage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Storage) ProtoMessage() {} - -func (x *AdminBackend_Storage) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Storage.ProtoReflect.Descriptor instead. -func (*AdminBackend_Storage) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 11} -} - -func (x *AdminBackend_Storage) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *AdminBackend_Storage) GetQiniu() *AdminBackend_Qiniu { - if x != nil { - return x.Qiniu - } - return nil -} - -func (x *AdminBackend_Storage) GetAliyunOss() *AdminBackend_ObjectStore { - if x != nil { - return x.AliyunOss - } - return nil -} - -func (x *AdminBackend_Storage) GetHuaweiObs() *AdminBackend_ObjectStore { - if x != nil { - return x.HuaweiObs - } - return nil -} - -func (x *AdminBackend_Storage) GetTencentCos() *AdminBackend_ObjectStore { - if x != nil { - return x.TencentCos - } - return nil -} - -func (x *AdminBackend_Storage) GetAwsS3() *AdminBackend_ObjectStore { - if x != nil { - return x.AwsS3 - } - return nil -} - -func (x *AdminBackend_Storage) GetCloudflareR2() *AdminBackend_ObjectStore { - if x != nil { - return x.CloudflareR2 - } - return nil -} - -func (x *AdminBackend_Storage) GetMinio() *AdminBackend_ObjectStore { - if x != nil { - return x.Minio - } - return nil -} - -type AdminBackend_Qiniu struct { - state protoimpl.MessageState `protogen:"open.v1"` - Zone string `protobuf:"bytes,1,opt,name=zone,proto3" json:"zone,omitempty"` - Bucket string `protobuf:"bytes,2,opt,name=bucket,proto3" json:"bucket,omitempty"` - BaseUrl string `protobuf:"bytes,3,opt,name=base_url,json=baseUrl,proto3" json:"base_url,omitempty"` - AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` - SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` - UseHttps bool `protobuf:"varint,6,opt,name=use_https,json=useHttps,proto3" json:"use_https,omitempty"` - UseCdnDomains bool `protobuf:"varint,7,opt,name=use_cdn_domains,json=useCdnDomains,proto3" json:"use_cdn_domains,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_Qiniu) Reset() { - *x = AdminBackend_Qiniu{} - mi := &file_conf_conf_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_Qiniu) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_Qiniu) ProtoMessage() {} - -func (x *AdminBackend_Qiniu) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_Qiniu.ProtoReflect.Descriptor instead. -func (*AdminBackend_Qiniu) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 12} -} - -func (x *AdminBackend_Qiniu) GetZone() string { - if x != nil { - return x.Zone - } - return "" -} - -func (x *AdminBackend_Qiniu) GetBucket() string { - if x != nil { - return x.Bucket - } - return "" -} - -func (x *AdminBackend_Qiniu) GetBaseUrl() string { - if x != nil { - return x.BaseUrl - } - return "" -} - -func (x *AdminBackend_Qiniu) GetAccessKey() string { - if x != nil { - return x.AccessKey - } - return "" -} - -func (x *AdminBackend_Qiniu) GetSecretKey() string { - if x != nil { - return x.SecretKey - } - return "" -} - -func (x *AdminBackend_Qiniu) GetUseHttps() bool { - if x != nil { - return x.UseHttps - } - return false -} - -func (x *AdminBackend_Qiniu) GetUseCdnDomains() bool { - if x != nil { - return x.UseCdnDomains - } - return false -} - -// ObjectStore covers S3-compatible configuration used by public cloud -// providers and self-hosted MinIO. -type AdminBackend_ObjectStore struct { - state protoimpl.MessageState `protogen:"open.v1"` - Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` - Bucket string `protobuf:"bytes,3,opt,name=bucket,proto3" json:"bucket,omitempty"` - AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` - SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` - BaseUrl string `protobuf:"bytes,6,opt,name=base_url,json=baseUrl,proto3" json:"base_url,omitempty"` - PathPrefix string `protobuf:"bytes,7,opt,name=path_prefix,json=pathPrefix,proto3" json:"path_prefix,omitempty"` - UseSsl bool `protobuf:"varint,8,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"` - ForcePathStyle bool `protobuf:"varint,9,opt,name=force_path_style,json=forcePathStyle,proto3" json:"force_path_style,omitempty"` - AccountId string `protobuf:"bytes,10,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AdminBackend_ObjectStore) Reset() { - *x = AdminBackend_ObjectStore{} - mi := &file_conf_conf_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AdminBackend_ObjectStore) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBackend_ObjectStore) ProtoMessage() {} - -func (x *AdminBackend_ObjectStore) ProtoReflect() protoreflect.Message { - mi := &file_conf_conf_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBackend_ObjectStore.ProtoReflect.Descriptor instead. -func (*AdminBackend_ObjectStore) Descriptor() ([]byte, []int) { - return file_conf_conf_proto_rawDescGZIP(), []int{3, 13} -} - -func (x *AdminBackend_ObjectStore) GetEndpoint() string { - if x != nil { - return x.Endpoint - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetBucket() string { - if x != nil { - return x.Bucket - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetAccessKey() string { - if x != nil { - return x.AccessKey - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetSecretKey() string { - if x != nil { - return x.SecretKey - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetBaseUrl() string { - if x != nil { - return x.BaseUrl - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetPathPrefix() string { - if x != nil { - return x.PathPrefix - } - return "" -} - -func (x *AdminBackend_ObjectStore) GetUseSsl() bool { - if x != nil { - return x.UseSsl - } - return false -} - -func (x *AdminBackend_ObjectStore) GetForcePathStyle() bool { - if x != nil { - return x.ForcePathStyle - } - return false -} - -func (x *AdminBackend_ObjectStore) GetAccountId() string { - if x != nil { - return x.AccountId - } - return "" -} - -var File_conf_conf_proto protoreflect.FileDescriptor - -const file_conf_conf_proto_rawDesc = "" + - "\n" + - "\x0fconf/conf.proto\x12\n" + - "kratos.api\x1a\x1egoogle/protobuf/duration.proto\"\x8d\x01\n" + - "\tBootstrap\x12*\n" + - "\x06server\x18\x01 \x01(\v2\x12.kratos.api.ServerR\x06server\x12$\n" + - "\x04data\x18\x02 \x01(\v2\x10.kratos.api.DataR\x04data\x12.\n" + - "\x05admin\x18\x03 \x01(\v2\x18.kratos.api.AdminBackendR\x05admin\"\xa0\x01\n" + - "\x06Server\x12+\n" + - "\x04http\x18\x01 \x01(\v2\x17.kratos.api.Server.HTTPR\x04http\x1ai\n" + - "\x04HTTP\x12\x18\n" + - "\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" + - "\x04addr\x18\x02 \x01(\tR\x04addr\x123\n" + - "\atimeout\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\atimeout\"\x86\f\n" + - "\x04Data\x125\n" + - "\bdatabase\x18\x01 \x01(\v2\x19.kratos.api.Data.DatabaseR\bdatabase\x12,\n" + - "\x05redis\x18\x02 \x01(\v2\x16.kratos.api.Data.RedisR\x05redis\x12>\n" + - "\rdatabase_list\x18\x03 \x03(\v2\x19.kratos.api.Data.DatabaseR\fdatabaseList\x125\n" + - "\n" + - "redis_list\x18\x04 \x03(\v2\x16.kratos.api.Data.RedisR\tredisList\x12,\n" + - "\x05mongo\x18\x05 \x01(\v2\x16.kratos.api.Data.MongoR\x05mongo\x1a\xea\x03\n" + - "\bDatabase\x12\x16\n" + - "\x06driver\x18\x01 \x01(\tR\x06driver\x12\x16\n" + - "\x06source\x18\x02 \x01(\tR\x06source\x12\x12\n" + - "\x04host\x18\x03 \x01(\tR\x04host\x12\x12\n" + - "\x04port\x18\x04 \x01(\tR\x04port\x12\x12\n" + - "\x04user\x18\x05 \x01(\tR\x04user\x12\x1a\n" + - "\bpassword\x18\x06 \x01(\tR\bpassword\x12\x12\n" + - "\x04name\x18\a \x01(\tR\x04name\x12\x16\n" + - "\x06config\x18\b \x01(\tR\x06config\x12\x12\n" + - "\x04path\x18\t \x01(\tR\x04path\x12\x1d\n" + - "\n" + - "alias_name\x18\n" + - " \x01(\tR\taliasName\x12\x18\n" + - "\adisable\x18\v \x01(\bR\adisable\x12\x16\n" + - "\x06prefix\x18\f \x01(\tR\x06prefix\x12\x16\n" + - "\x06engine\x18\r \x01(\tR\x06engine\x12\x19\n" + - "\blog_mode\x18\x0e \x01(\tR\alogMode\x12$\n" + - "\x0emax_idle_conns\x18\x0f \x01(\x05R\fmaxIdleConns\x12$\n" + - "\x0emax_open_conns\x18\x10 \x01(\x05R\fmaxOpenConns\x12*\n" + - "\x11conn_max_lifetime\x18\x11 \x01(\x05R\x0fconnMaxLifetime\x12\x1a\n" + - "\bsingular\x18\x12 \x01(\bR\bsingular\x1a\xb9\x02\n" + - "\x05Redis\x12\x18\n" + - "\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" + - "\x04addr\x18\x02 \x01(\tR\x04addr\x12<\n" + - "\fread_timeout\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\vreadTimeout\x12>\n" + - "\rwrite_timeout\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\fwriteTimeout\x12\x12\n" + - "\x04name\x18\x05 \x01(\tR\x04name\x12\x1a\n" + - "\bpassword\x18\x06 \x01(\tR\bpassword\x12\x0e\n" + - "\x02db\x18\a \x01(\x05R\x02db\x12\x1f\n" + - "\vuse_cluster\x18\b \x01(\bR\n" + - "useCluster\x12#\n" + - "\rcluster_addrs\x18\t \x03(\tR\fclusterAddrs\x1a3\n" + - "\tMongoHost\x12\x12\n" + - "\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" + - "\x04port\x18\x02 \x01(\tR\x04port\x1a\x95\x03\n" + - "\x05Mongo\x12\x12\n" + - "\x04coll\x18\x01 \x01(\tR\x04coll\x12\x18\n" + - "\aoptions\x18\x02 \x01(\tR\aoptions\x12\x1a\n" + - "\bdatabase\x18\x03 \x01(\tR\bdatabase\x12\x1a\n" + - "\busername\x18\x04 \x01(\tR\busername\x12\x1a\n" + - "\bpassword\x18\x05 \x01(\tR\bpassword\x12\x1f\n" + - "\vauth_source\x18\x06 \x01(\tR\n" + - "authSource\x12\"\n" + - "\rmin_pool_size\x18\a \x01(\x04R\vminPoolSize\x12\"\n" + - "\rmax_pool_size\x18\b \x01(\x04R\vmaxPoolSize\x12*\n" + - "\x11socket_timeout_ms\x18\t \x01(\x03R\x0fsocketTimeoutMs\x12,\n" + - "\x12connect_timeout_ms\x18\n" + - " \x01(\x03R\x10connectTimeoutMs\x12\x15\n" + - "\x06is_zap\x18\v \x01(\bR\x05isZap\x120\n" + - "\x05hosts\x18\f \x03(\v2\x1a.kratos.api.Data.MongoHostR\x05hosts\"\xad\x1c\n" + - "\fAdminBackend\x12#\n" + - "\rrouter_prefix\x18\x01 \x01(\tR\frouterPrefix\x12.\n" + - "\x03jwt\x18\x02 \x01(\v2\x1c.kratos.api.AdminBackend.JWTR\x03jwt\x12:\n" + - "\acaptcha\x18\x03 \x01(\v2 .kratos.api.AdminBackend.CaptchaR\acaptcha\x124\n" + - "\x05local\x18\x04 \x01(\v2\x1e.kratos.api.AdminBackend.LocalR\x05local\x124\n" + - "\x05email\x18\x05 \x01(\v2\x1e.kratos.api.AdminBackend.EmailR\x05email\x12:\n" + - "\astorage\x18\x06 \x01(\v2 .kratos.api.AdminBackend.StorageR\astorage\x12\x1f\n" + - "\vconfig_path\x18\a \x01(\tR\n" + - "configPath\x124\n" + - "\x05media\x18\b \x01(\v2\x1e.kratos.api.AdminBackend.MediaR\x05media\x12:\n" + - "\tdisk_list\x18\t \x03(\v2\x1d.kratos.api.AdminBackend.DiskR\bdiskList\x127\n" + - "\x06system\x18\n" + - " \x01(\v2\x1f.kratos.api.AdminBackend.SystemR\x06system\x12.\n" + - "\x03zap\x18\v \x01(\v2\x1c.kratos.api.AdminBackend.ZapR\x03zap\x121\n" + - "\x04cors\x18\f \x01(\v2\x1d.kratos.api.AdminBackend.CORSR\x04cors\x12.\n" + - "\x03app\x18\r \x01(\v2\x1c.kratos.api.AdminBackend.AppR\x03app\x1a\xb8\x01\n" + - "\x03JWT\x12\x1f\n" + - "\vsigning_key\x18\x01 \x01(\tR\n" + - "signingKey\x12<\n" + - "\fexpires_time\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\vexpiresTime\x12:\n" + - "\vbuffer_time\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\n" + - "bufferTime\x12\x16\n" + - "\x06issuer\x18\x04 \x01(\tR\x06issuer\x1a\xa6\x01\n" + - "\aCaptcha\x12\x19\n" + - "\bkey_long\x18\x01 \x01(\x05R\akeyLong\x12\x1b\n" + - "\timg_width\x18\x02 \x01(\x05R\bimgWidth\x12\x1d\n" + - "\n" + - "img_height\x18\x03 \x01(\x05R\timgHeight\x12D\n" + - "\x10store_expiration\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\x0fstoreExpiration\x1aG\n" + - "\x05Local\x12\x1d\n" + - "\n" + - "store_path\x18\x01 \x01(\tR\tstorePath\x12\x1f\n" + - "\vpath_prefix\x18\x02 \x01(\tR\n" + - "pathPrefix\x1a\xc2\x01\n" + - "\x05Email\x12\x0e\n" + - "\x02to\x18\x01 \x01(\tR\x02to\x12\x12\n" + - "\x04from\x18\x02 \x01(\tR\x04from\x12\x12\n" + - "\x04host\x18\x03 \x01(\tR\x04host\x12\x16\n" + - "\x06secret\x18\x04 \x01(\tR\x06secret\x12\x1a\n" + - "\bnickname\x18\x05 \x01(\tR\bnickname\x12\x12\n" + - "\x04port\x18\x06 \x01(\x05R\x04port\x12\x15\n" + - "\x06is_ssl\x18\a \x01(\bR\x05isSsl\x12\"\n" + - "\ris_login_auth\x18\b \x01(\bR\visLoginAuth\x1ai\n" + - "\x05Media\x12\x1f\n" + - "\vsession_ttl\x18\x01 \x01(\x05R\n" + - "sessionTtl\x12\"\n" + - "\rmax_file_size\x18\x02 \x01(\x03R\vmaxFileSize\x12\x1b\n" + - "\tchunk_dir\x18\x03 \x01(\tR\bchunkDir\x1a'\n" + - "\x04Disk\x12\x1f\n" + - "\vmount_point\x18\x01 \x01(\tR\n" + - "mountPoint\x1a\x9f\x02\n" + - "\x06System\x12\x1b\n" + - "\tuse_redis\x18\x01 \x01(\bR\buseRedis\x12%\n" + - "\x0euse_multipoint\x18\x02 \x01(\bR\ruseMultipoint\x12&\n" + - "\x0fuse_strict_auth\x18\x03 \x01(\bR\ruseStrictAuth\x120\n" + - "\x14disable_auto_migrate\x18\x04 \x01(\bR\x12disableAutoMigrate\x12\x1b\n" + - "\tuse_mongo\x18\x05 \x01(\bR\buseMongo\x12\x12\n" + - "\x04addr\x18\x06 \x01(\x05R\x04addr\x12#\n" + - "\riplimit_count\x18\a \x01(\x05R\fiplimitCount\x12!\n" + - "\fiplimit_time\x18\b \x01(\x05R\viplimitTime\x1a\xf6\x03\n" + - "\x03Zap\x12\x14\n" + - "\x05level\x18\x01 \x01(\tR\x05level\x12\x16\n" + - "\x06prefix\x18\x02 \x01(\tR\x06prefix\x12\x16\n" + - "\x06format\x18\x03 \x01(\tR\x06format\x12\x1a\n" + - "\bdirector\x18\x04 \x01(\tR\bdirector\x12!\n" + - "\fencode_level\x18\x05 \x01(\tR\vencodeLevel\x12%\n" + - "\x0estacktrace_key\x18\x06 \x01(\tR\rstacktraceKey\x12\x1b\n" + - "\tshow_line\x18\a \x01(\bR\bshowLine\x12$\n" + - "\x0elog_in_console\x18\b \x01(\bR\flogInConsole\x12#\n" + - "\rretention_day\x18\t \x01(\x05R\fretentionDay\x12&\n" + - "\x0faccess_req_body\x18\n" + - " \x01(\bR\raccessReqBody\x12(\n" + - "\x10access_resp_data\x18\v \x01(\bR\x0eaccessRespData\x12,\n" + - "\x12access_req_headers\x18\f \x01(\bR\x10accessReqHeaders\x12/\n" + - "\x14access_log_max_bytes\x18\r \x01(\x05R\x11accessLogMaxBytes\x12*\n" + - "\x11file_only_modules\x18\x0e \x03(\tR\x0ffileOnlyModules\x1a[\n" + - "\x04CORS\x12\x12\n" + - "\x04mode\x18\x01 \x01(\tR\x04mode\x12?\n" + - "\twhitelist\x18\x02 \x03(\v2!.kratos.api.AdminBackend.CORSRuleR\twhitelist\x1a\xcb\x01\n" + - "\bCORSRule\x12!\n" + - "\fallow_origin\x18\x01 \x01(\tR\vallowOrigin\x12#\n" + - "\rallow_methods\x18\x02 \x01(\tR\fallowMethods\x12#\n" + - "\rallow_headers\x18\x03 \x01(\tR\fallowHeaders\x12%\n" + - "\x0eexpose_headers\x18\x04 \x01(\tR\rexposeHeaders\x12+\n" + - "\x11allow_credentials\x18\x05 \x01(\bR\x10allowCredentials\x1aB\n" + - "\x03App\x12\x12\n" + - "\x04node\x18\x01 \x01(\tR\x04node\x12\x15\n" + - "\x06app_id\x18\x02 \x01(\tR\x05appId\x12\x10\n" + - "\x03env\x18\x03 \x01(\tR\x03env\x1a\xe8\x03\n" + - "\aStorage\x12\x12\n" + - "\x04type\x18\x01 \x01(\tR\x04type\x124\n" + - "\x05qiniu\x18\x02 \x01(\v2\x1e.kratos.api.AdminBackend.QiniuR\x05qiniu\x12C\n" + - "\n" + - "aliyun_oss\x18\x03 \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\taliyunOss\x12C\n" + - "\n" + - "huawei_obs\x18\x04 \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\thuaweiObs\x12E\n" + - "\vtencent_cos\x18\x05 \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\n" + - "tencentCos\x12;\n" + - "\x06aws_s3\x18\x06 \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\x05awsS3\x12I\n" + - "\rcloudflare_r2\x18\a \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\fcloudflareR2\x12:\n" + - "\x05minio\x18\b \x01(\v2$.kratos.api.AdminBackend.ObjectStoreR\x05minio\x1a\xd1\x01\n" + - "\x05Qiniu\x12\x12\n" + - "\x04zone\x18\x01 \x01(\tR\x04zone\x12\x16\n" + - "\x06bucket\x18\x02 \x01(\tR\x06bucket\x12\x19\n" + - "\bbase_url\x18\x03 \x01(\tR\abaseUrl\x12\x1d\n" + - "\n" + - "access_key\x18\x04 \x01(\tR\taccessKey\x12\x1d\n" + - "\n" + - "secret_key\x18\x05 \x01(\tR\tsecretKey\x12\x1b\n" + - "\tuse_https\x18\x06 \x01(\bR\buseHttps\x12&\n" + - "\x0fuse_cdn_domains\x18\a \x01(\bR\ruseCdnDomains\x1a\xb5\x02\n" + - "\vObjectStore\x12\x1a\n" + - "\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x16\n" + - "\x06region\x18\x02 \x01(\tR\x06region\x12\x16\n" + - "\x06bucket\x18\x03 \x01(\tR\x06bucket\x12\x1d\n" + - "\n" + - "access_key\x18\x04 \x01(\tR\taccessKey\x12\x1d\n" + - "\n" + - "secret_key\x18\x05 \x01(\tR\tsecretKey\x12\x19\n" + - "\bbase_url\x18\x06 \x01(\tR\abaseUrl\x12\x1f\n" + - "\vpath_prefix\x18\a \x01(\tR\n" + - "pathPrefix\x12\x17\n" + - "\ause_ssl\x18\b \x01(\bR\x06useSsl\x12(\n" + - "\x10force_path_style\x18\t \x01(\bR\x0eforcePathStyle\x12\x1d\n" + - "\n" + - "account_id\x18\n" + - " \x01(\tR\taccountIdB\x18Z\x16kra/internal/conf;confb\x06proto3" - -var ( - file_conf_conf_proto_rawDescOnce sync.Once - file_conf_conf_proto_rawDescData []byte -) - -func file_conf_conf_proto_rawDescGZIP() []byte { - file_conf_conf_proto_rawDescOnce.Do(func() { - file_conf_conf_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_conf_conf_proto_rawDesc), len(file_conf_conf_proto_rawDesc))) - }) - return file_conf_conf_proto_rawDescData -} - -var file_conf_conf_proto_msgTypes = make([]protoimpl.MessageInfo, 23) -var file_conf_conf_proto_goTypes = []any{ - (*Bootstrap)(nil), // 0: kratos.api.Bootstrap - (*Server)(nil), // 1: kratos.api.Server - (*Data)(nil), // 2: kratos.api.Data - (*AdminBackend)(nil), // 3: kratos.api.AdminBackend - (*Server_HTTP)(nil), // 4: kratos.api.Server.HTTP - (*Data_Database)(nil), // 5: kratos.api.Data.Database - (*Data_Redis)(nil), // 6: kratos.api.Data.Redis - (*Data_MongoHost)(nil), // 7: kratos.api.Data.MongoHost - (*Data_Mongo)(nil), // 8: kratos.api.Data.Mongo - (*AdminBackend_JWT)(nil), // 9: kratos.api.AdminBackend.JWT - (*AdminBackend_Captcha)(nil), // 10: kratos.api.AdminBackend.Captcha - (*AdminBackend_Local)(nil), // 11: kratos.api.AdminBackend.Local - (*AdminBackend_Email)(nil), // 12: kratos.api.AdminBackend.Email - (*AdminBackend_Media)(nil), // 13: kratos.api.AdminBackend.Media - (*AdminBackend_Disk)(nil), // 14: kratos.api.AdminBackend.Disk - (*AdminBackend_System)(nil), // 15: kratos.api.AdminBackend.System - (*AdminBackend_Zap)(nil), // 16: kratos.api.AdminBackend.Zap - (*AdminBackend_CORS)(nil), // 17: kratos.api.AdminBackend.CORS - (*AdminBackend_CORSRule)(nil), // 18: kratos.api.AdminBackend.CORSRule - (*AdminBackend_App)(nil), // 19: kratos.api.AdminBackend.App - (*AdminBackend_Storage)(nil), // 20: kratos.api.AdminBackend.Storage - (*AdminBackend_Qiniu)(nil), // 21: kratos.api.AdminBackend.Qiniu - (*AdminBackend_ObjectStore)(nil), // 22: kratos.api.AdminBackend.ObjectStore - (*durationpb.Duration)(nil), // 23: google.protobuf.Duration -} -var file_conf_conf_proto_depIdxs = []int32{ - 1, // 0: kratos.api.Bootstrap.server:type_name -> kratos.api.Server - 2, // 1: kratos.api.Bootstrap.data:type_name -> kratos.api.Data - 3, // 2: kratos.api.Bootstrap.admin:type_name -> kratos.api.AdminBackend - 4, // 3: kratos.api.Server.http:type_name -> kratos.api.Server.HTTP - 5, // 4: kratos.api.Data.database:type_name -> kratos.api.Data.Database - 6, // 5: kratos.api.Data.redis:type_name -> kratos.api.Data.Redis - 5, // 6: kratos.api.Data.database_list:type_name -> kratos.api.Data.Database - 6, // 7: kratos.api.Data.redis_list:type_name -> kratos.api.Data.Redis - 8, // 8: kratos.api.Data.mongo:type_name -> kratos.api.Data.Mongo - 9, // 9: kratos.api.AdminBackend.jwt:type_name -> kratos.api.AdminBackend.JWT - 10, // 10: kratos.api.AdminBackend.captcha:type_name -> kratos.api.AdminBackend.Captcha - 11, // 11: kratos.api.AdminBackend.local:type_name -> kratos.api.AdminBackend.Local - 12, // 12: kratos.api.AdminBackend.email:type_name -> kratos.api.AdminBackend.Email - 20, // 13: kratos.api.AdminBackend.storage:type_name -> kratos.api.AdminBackend.Storage - 13, // 14: kratos.api.AdminBackend.media:type_name -> kratos.api.AdminBackend.Media - 14, // 15: kratos.api.AdminBackend.disk_list:type_name -> kratos.api.AdminBackend.Disk - 15, // 16: kratos.api.AdminBackend.system:type_name -> kratos.api.AdminBackend.System - 16, // 17: kratos.api.AdminBackend.zap:type_name -> kratos.api.AdminBackend.Zap - 17, // 18: kratos.api.AdminBackend.cors:type_name -> kratos.api.AdminBackend.CORS - 19, // 19: kratos.api.AdminBackend.app:type_name -> kratos.api.AdminBackend.App - 23, // 20: kratos.api.Server.HTTP.timeout:type_name -> google.protobuf.Duration - 23, // 21: kratos.api.Data.Redis.read_timeout:type_name -> google.protobuf.Duration - 23, // 22: kratos.api.Data.Redis.write_timeout:type_name -> google.protobuf.Duration - 7, // 23: kratos.api.Data.Mongo.hosts:type_name -> kratos.api.Data.MongoHost - 23, // 24: kratos.api.AdminBackend.JWT.expires_time:type_name -> google.protobuf.Duration - 23, // 25: kratos.api.AdminBackend.JWT.buffer_time:type_name -> google.protobuf.Duration - 23, // 26: kratos.api.AdminBackend.Captcha.store_expiration:type_name -> google.protobuf.Duration - 18, // 27: kratos.api.AdminBackend.CORS.whitelist:type_name -> kratos.api.AdminBackend.CORSRule - 21, // 28: kratos.api.AdminBackend.Storage.qiniu:type_name -> kratos.api.AdminBackend.Qiniu - 22, // 29: kratos.api.AdminBackend.Storage.aliyun_oss:type_name -> kratos.api.AdminBackend.ObjectStore - 22, // 30: kratos.api.AdminBackend.Storage.huawei_obs:type_name -> kratos.api.AdminBackend.ObjectStore - 22, // 31: kratos.api.AdminBackend.Storage.tencent_cos:type_name -> kratos.api.AdminBackend.ObjectStore - 22, // 32: kratos.api.AdminBackend.Storage.aws_s3:type_name -> kratos.api.AdminBackend.ObjectStore - 22, // 33: kratos.api.AdminBackend.Storage.cloudflare_r2:type_name -> kratos.api.AdminBackend.ObjectStore - 22, // 34: kratos.api.AdminBackend.Storage.minio:type_name -> kratos.api.AdminBackend.ObjectStore - 35, // [35:35] is the sub-list for method output_type - 35, // [35:35] is the sub-list for method input_type - 35, // [35:35] is the sub-list for extension type_name - 35, // [35:35] is the sub-list for extension extendee - 0, // [0:35] is the sub-list for field type_name -} - -func init() { file_conf_conf_proto_init() } -func file_conf_conf_proto_init() { - if File_conf_conf_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_conf_conf_proto_rawDesc), len(file_conf_conf_proto_rawDesc)), - NumEnums: 0, - NumMessages: 23, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_conf_conf_proto_goTypes, - DependencyIndexes: file_conf_conf_proto_depIdxs, - MessageInfos: file_conf_conf_proto_msgTypes, - }.Build() - File_conf_conf_proto = out.File - file_conf_conf_proto_goTypes = nil - file_conf_conf_proto_depIdxs = nil -} diff --git a/internal/conf/conf.proto b/internal/conf/conf.proto deleted file mode 100644 index 391489d..0000000 --- a/internal/conf/conf.proto +++ /dev/null @@ -1,218 +0,0 @@ -syntax = "proto3"; -package kratos.api; - -import "google/protobuf/duration.proto"; - -option go_package = "kra/internal/conf;conf"; - -message Bootstrap { - Server server = 1; - Data data = 2; - AdminBackend admin = 3; -} - -message Server { - message HTTP { - string network = 1; - string addr = 2; - google.protobuf.Duration timeout = 3; - } - HTTP http = 1; -} - -message Data { - message Database { - string driver = 1; - string source = 2; - string host = 3; - string port = 4; - string user = 5; - string password = 6; - string name = 7; - string config = 8; - string path = 9; - string alias_name = 10; - bool disable = 11; - string prefix = 12; - string engine = 13; - string log_mode = 14; - int32 max_idle_conns = 15; - int32 max_open_conns = 16; - int32 conn_max_lifetime = 17; - bool singular = 18; - } - message Redis { - string network = 1; - string addr = 2; - google.protobuf.Duration read_timeout = 3; - google.protobuf.Duration write_timeout = 4; - string name = 5; - string password = 6; - int32 db = 7; - bool use_cluster = 8; - repeated string cluster_addrs = 9; - } - message MongoHost { - string host = 1; - string port = 2; - } - message Mongo { - string coll = 1; - string options = 2; - string database = 3; - string username = 4; - string password = 5; - string auth_source = 6; - uint64 min_pool_size = 7; - uint64 max_pool_size = 8; - int64 socket_timeout_ms = 9; - int64 connect_timeout_ms = 10; - bool is_zap = 11; - repeated MongoHost hosts = 12; - } - Database database = 1; - Redis redis = 2; - repeated Database database_list = 3; - repeated Redis redis_list = 4; - Mongo mongo = 5; -} - -// AdminBackend contains settings for the administration HTTP transport. -message AdminBackend { - string router_prefix = 1; - JWT jwt = 2; - Captcha captcha = 3; - Local local = 4; - Email email = 5; - Storage storage = 6; - // ConfigPath is populated by the entrypoint and is not required in YAML. - string config_path = 7; - Media media = 8; - repeated Disk disk_list = 9; - System system = 10; - Zap zap = 11; - CORS cors = 12; - App app = 13; - - message JWT { - string signing_key = 1; - google.protobuf.Duration expires_time = 2; - google.protobuf.Duration buffer_time = 3; - string issuer = 4; - } - - message Captcha { - int32 key_long = 1; - int32 img_width = 2; - int32 img_height = 3; - google.protobuf.Duration store_expiration = 4; - } - - message Local { - string store_path = 1; - string path_prefix = 2; - } - - message Email { - string to = 1; - string from = 2; - string host = 3; - string secret = 4; - string nickname = 5; - int32 port = 6; - bool is_ssl = 7; - bool is_login_auth = 8; - } - - message Media { - int32 session_ttl = 1; - int64 max_file_size = 2; - string chunk_dir = 3; - } - - message Disk { - string mount_point = 1; - } - - message System { - bool use_redis = 1; - bool use_multipoint = 2; - bool use_strict_auth = 3; - bool disable_auto_migrate = 4; - bool use_mongo = 5; - int32 addr = 6; - int32 iplimit_count = 7; - int32 iplimit_time = 8; - } - - message Zap { - string level = 1; - string prefix = 2; - string format = 3; - string director = 4; - string encode_level = 5; - string stacktrace_key = 6; - bool show_line = 7; - bool log_in_console = 8; - int32 retention_day = 9; - bool access_req_body = 10; - bool access_resp_data = 11; - bool access_req_headers = 12; - int32 access_log_max_bytes = 13; - repeated string file_only_modules = 14; - } - - message CORS { - string mode = 1; - repeated CORSRule whitelist = 2; - } - message CORSRule { - string allow_origin = 1; - string allow_methods = 2; - string allow_headers = 3; - string expose_headers = 4; - bool allow_credentials = 5; - } - message App { - string node = 1; - string app_id = 2; - string env = 3; - } - - message Storage { - string type = 1; - Qiniu qiniu = 2; - ObjectStore aliyun_oss = 3; - ObjectStore huawei_obs = 4; - ObjectStore tencent_cos = 5; - ObjectStore aws_s3 = 6; - ObjectStore cloudflare_r2 = 7; - ObjectStore minio = 8; - } - - message Qiniu { - string zone = 1; - string bucket = 2; - string base_url = 3; - string access_key = 4; - string secret_key = 5; - bool use_https = 6; - bool use_cdn_domains = 7; - } - - // ObjectStore covers S3-compatible configuration used by public cloud - // providers and self-hosted MinIO. - message ObjectStore { - string endpoint = 1; - string region = 2; - string bucket = 3; - string access_key = 4; - string secret_key = 5; - string base_url = 6; - string path_prefix = 7; - bool use_ssl = 8; - bool force_path_style = 9; - string account_id = 10; - } -} - diff --git a/internal/conf/runtime.go b/internal/conf/runtime.go deleted file mode 100644 index e8bf6f6..0000000 --- a/internal/conf/runtime.go +++ /dev/null @@ -1,128 +0,0 @@ -package conf - -import ( - "sync" - "sync/atomic" - - "google.golang.org/protobuf/proto" -) - -// Runtime owns the active immutable configuration snapshot. Callers always -// receive clones so a config file reload cannot race with request handling. -type Runtime struct { - snapshot atomic.Pointer[runtimeSnapshot] - mu sync.RWMutex - nextID uint64 - listeners map[uint64]func(*Data, *AdminBackend) -} - -type runtimeSnapshot struct { - data *Data - admin *AdminBackend -} - -func NewRuntime(data *Data, admin *AdminBackend) *Runtime { - runtime := &Runtime{listeners: make(map[uint64]func(*Data, *AdminBackend))} - runtime.Replace(data, admin) - return runtime -} - -func cloneData(value *Data) *Data { - if value == nil { - return nil - } - return proto.Clone(value).(*Data) -} - -func cloneAdmin(value *AdminBackend) *AdminBackend { - if value == nil { - return nil - } - return proto.Clone(value).(*AdminBackend) -} - -func (r *Runtime) Replace(data *Data, admin *AdminBackend) { - data = cloneData(data) - admin = cloneAdmin(admin) - r.snapshot.Store(&runtimeSnapshot{data: data, admin: admin}) - r.mu.RLock() - listeners := make([]func(*Data, *AdminBackend), 0, len(r.listeners)) - for _, listener := range r.listeners { - listeners = append(listeners, listener) - } - r.mu.RUnlock() - for _, listener := range listeners { - listener(cloneData(data), cloneAdmin(admin)) - } -} - -// Subscribe registers a callback invoked after every successful runtime -// configuration replacement. It is used by long-lived clients such as the -// logger and other long-lived clients that must follow runtime config changes. -func (r *Runtime) Subscribe(listener func(*Data, *AdminBackend)) func() { - if listener == nil { - return func() {} - } - r.mu.Lock() - r.nextID++ - id := r.nextID - r.listeners[id] = listener - r.mu.Unlock() - return func() { - r.mu.Lock() - delete(r.listeners, id) - r.mu.Unlock() - } -} - -func (r *Runtime) Data() *Data { - snapshot := r.snapshot.Load() - if snapshot == nil { - return nil - } - return cloneData(snapshot.data) -} - -func (r *Runtime) Admin() *AdminBackend { - snapshot := r.snapshot.Load() - if snapshot == nil { - return nil - } - return cloneAdmin(snapshot.admin) -} - -func (r *Runtime) Values() (*Data, *AdminBackend) { - snapshot := r.snapshot.Load() - if snapshot == nil { - return nil, nil - } - return cloneData(snapshot.data), cloneAdmin(snapshot.admin) -} - -func (r *Runtime) ConfigPath() string { - snapshot := r.snapshot.Load() - if snapshot == nil || snapshot.admin == nil { - return "" - } - return snapshot.admin.ConfigPath -} - -func (r *Runtime) UpdateDatabase(database *Data_Database) { - for { - current := r.snapshot.Load() - var data *Data - var admin *AdminBackend - if current != nil { - data = cloneData(current.data) - admin = cloneAdmin(current.admin) - } - if data == nil { - data = &Data{} - } - data.Database = proto.Clone(database).(*Data_Database) - next := &runtimeSnapshot{data: data, admin: admin} - if r.snapshot.CompareAndSwap(current, next) { - return - } - } -} diff --git a/internal/conf/runtime_test.go b/internal/conf/runtime_test.go deleted file mode 100644 index b886961..0000000 --- a/internal/conf/runtime_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package conf - -import ( - "sync" - "testing" -) - -func TestRuntimeSnapshotsAreImmutable(t *testing.T) { - runtime := NewRuntime(&Data{Database: &Data_Database{Name: "first"}}, &AdminBackend{RouterPrefix: "/api", Jwt: &AdminBackend_JWT{SigningKey: "secret"}}) - admin := runtime.Admin() - admin.RouterPrefix = "/changed" - admin.Jwt.SigningKey = "changed" - data := runtime.Data() - data.Database.Name = "changed" - - if got := runtime.Admin(); got.RouterPrefix != "/api" || got.Jwt.SigningKey != "secret" { - t.Fatalf("admin snapshot mutated: %+v", got) - } - if got := runtime.Data().Database.Name; got != "first" { - t.Fatalf("data snapshot mutated: %s", got) - } -} - -func TestRuntimeConcurrentReplaceAndRead(t *testing.T) { - runtime := NewRuntime(&Data{Database: &Data_Database{Name: "initial"}}, &AdminBackend{Jwt: &AdminBackend_JWT{SigningKey: "initial"}}) - var wait sync.WaitGroup - for worker := 0; worker < 8; worker++ { - wait.Add(1) - go func() { - defer wait.Done() - for index := 0; index < 500; index++ { - _ = runtime.Admin().Jwt.SigningKey - _ = runtime.Data().Database.Name - } - }() - } - for index := 0; index < 500; index++ { - runtime.Replace(&Data{Database: &Data_Database{Name: "next"}}, &AdminBackend{Jwt: &AdminBackend_JWT{SigningKey: "next"}}) - } - wait.Wait() -} diff --git a/internal/data/config_store.go b/internal/data/config_store.go index 68b0f44..087da85 100644 --- a/internal/data/config_store.go +++ b/internal/data/config_store.go @@ -2,7 +2,6 @@ package data import ( "context" - "encoding/json" "fmt" "net" "os" diff --git a/internal/data/config_watch.go b/internal/data/config_watch.go index d8684ab..784b32e 100644 --- a/internal/data/config_watch.go +++ b/internal/data/config_watch.go @@ -6,6 +6,7 @@ import ( "time" "github.com/fsnotify/fsnotify" + "kra/internal/config" ) // watchConfig refreshes the in-memory config snapshot on file changes, while @@ -79,10 +80,13 @@ func (d *Data) watchConfig() func() { logger.Error("reload changed config", "mod", "system", "error", loadErr) continue } - if next.Data == nil || next.Admin == nil { - logger.Error("reload changed config: data and admin configuration are required", "mod", "system") + if next.Data == nil { + logger.Error("reload changed config: data configuration is required", "mod", "system") continue } + if next.Admin == nil { + next.Admin = &config.Admin{} + } if current := d.runtime.Admin(); current != nil { next.Admin.Storage = current.Storage next.Admin.Email = current.Email diff --git a/internal/data/config_watch_test.go b/internal/data/config_watch_test.go index 0e6979f..2f9bcc0 100644 --- a/internal/data/config_watch_test.go +++ b/internal/data/config_watch_test.go @@ -13,15 +13,15 @@ import ( func TestConfigWatcherStopWaitsForDebouncedReload(t *testing.T) { root := t.TempDir() configPath := filepath.Join(root, "config.yaml") - config := []byte("data:\n database:\n driver: sqlite\n path: " + filepath.ToSlash(root) + "\nadmin: {}\n") - if err := os.WriteFile(configPath, config, 0o600); err != nil { + rawConfig := []byte("data:\n database:\n driver: sqlite\n path: " + filepath.ToSlash(root) + "\nadmin: {}\n") + if err := os.WriteFile(configPath, rawConfig, 0o600); err != nil { t.Fatal(err) } runtime := config.NewStore(&config.Config{Data: &config.Data{}, Admin: &config.Admin{ConfigPath: configPath}}) started := make(chan struct{}) release := make(chan struct{}) var startOnce sync.Once - stopListener := runtime.Subscribe(func(*config.Data, *config.Admin) { + stopListener := runtime.Subscribe(func(*config.Config) { startOnce.Do(func() { close(started) }) <-release }) @@ -30,7 +30,7 @@ func TestConfigWatcherStopWaitsForDebouncedReload(t *testing.T) { stop := data.watchConfig() // A write event schedules the 100ms debounce reload. - if err := os.WriteFile(configPath, config, 0o600); err != nil { + if err := os.WriteFile(configPath, rawConfig, 0o600); err != nil { t.Fatal(err) } select { diff --git a/internal/data/initialization_backend_test.go b/internal/data/initialization_backend_test.go index 53bf80e..d0fdd76 100644 --- a/internal/data/initialization_backend_test.go +++ b/internal/data/initialization_backend_test.go @@ -78,7 +78,7 @@ extension: if err := os.WriteFile(configPath, []byte(original), 0o600); err != nil { t.Fatal(err) } - runtime := config.NewStore(&config.Data{}, &config.Admin{ConfigPath: configPath}) + runtime := config.NewStore(&config.Config{Data: &config.Data{}, Admin: &config.Admin{ConfigPath: configPath}}) data := &Data{runtime: runtime} if err := data.persistDatabaseConfig(&config.Database{Driver: "mysql", Host: "db", Port: "3306", User: "root", Password: "secret", Name: "kra", Config: "parseTime=True"}, "new-key"); err != nil { t.Fatal(err) diff --git a/internal/data/integration_config_test.go b/internal/data/integration_config_test.go index 4eef7a9..4b9c628 100644 --- a/internal/data/integration_config_test.go +++ b/internal/data/integration_config_test.go @@ -12,7 +12,6 @@ import ( dataintegration "kra/internal/data/integration" "kra/internal/integration/storage" - "google.golang.org/protobuf/encoding/protojson" "gopkg.in/yaml.v3" "gorm.io/gorm" ) @@ -59,9 +58,9 @@ func TestStorageIntegrationConfigRoundTrip(t *testing.T) { Qiniu: &config.Qiniu{ Zone: "ZoneHuadong", Bucket: "qiniu-bucket", AccessKey: "qiniu-key", SecretKey: "qiniu-secret", }, - AliyunOss: &config.ObjectStore{ + AliyunOSS: &config.ObjectStore{ Endpoint: "oss-cn-hangzhou.aliyuncs.com", Region: "cn-hangzhou", Bucket: "assets", - AccessKey: "aliyun-key", SecretKey: "aliyun-secret", BaseUrl: "https://cdn.example.com", PathPrefix: "uploads", + AccessKey: "aliyun-key", SecretKey: "aliyun-secret", BaseURL: "https://cdn.example.com", PathPrefix: "uploads", }, Minio: &config.ObjectStore{Endpoint: "127.0.0.1:9000", Bucket: "local", ForcePathStyle: true}, } @@ -70,7 +69,7 @@ func TestStorageIntegrationConfigRoundTrip(t *testing.T) { } email := &config.Email{ To: "ops@example.com", From: "mailer@example.com", Host: "smtp.example.com", - Secret: "smtp-secret", Nickname: "Kra", Port: 465, IsSsl: true, + Secret: "smtp-secret", Nickname: "Kra", Port: 465, IsSSL: true, } if err := saveEmailIntegrationConfig(db, email); err != nil { t.Fatal(err) @@ -135,7 +134,7 @@ func TestResolveStorageIntegrationConfigMigratesLegacyOnlyOnce(t *testing.T) { if err != nil { t.Fatal(err) } - if loaded.Type != "qiniu" || loaded.Qiniu.GetBucket() != "legacy" { + if loaded.Type != "qiniu" || loaded.Qiniu.Bucket != "legacy" { t.Fatalf("migrated storage = %#v", loaded) } @@ -147,7 +146,7 @@ func TestResolveStorageIntegrationConfigMigratesLegacyOnlyOnce(t *testing.T) { if err != nil { t.Fatal(err) } - if loaded.Type != "qiniu" || loaded.Qiniu.GetSecretKey() != "legacy-secret" { + if loaded.Type != "qiniu" || loaded.Qiniu.SecretKey != "legacy-secret" { t.Fatalf("database configuration was replaced by legacy config: %#v", loaded) } } @@ -155,7 +154,7 @@ func TestResolveStorageIntegrationConfigMigratesLegacyOnlyOnce(t *testing.T) { func TestMaskStorageSecretsLeavesUnconfiguredProvidersEmpty(t *testing.T) { storage := &config.Storage{ Qiniu: &config.Qiniu{}, - AliyunOss: &config.ObjectStore{SecretKey: "configured-secret"}, + AliyunOSS: &config.ObjectStore{SecretKey: "configured-secret"}, Minio: &config.ObjectStore{}, } maskStorageSecrets(storage) @@ -169,7 +168,7 @@ func TestMaskStorageSecretsLeavesUnconfiguredProvidersEmpty(t *testing.T) { func TestResolveEmailIntegrationConfigMigratesLegacyOnlyOnce(t *testing.T) { db := openIntegrationConfigTestDB(t) - legacy := &config.Email{To: "ops@example.com", From: "old@example.com", Host: "smtp.old.example.com", Secret: "old-secret", Port: 465, IsSsl: true} + legacy := &config.Email{To: "ops@example.com", From: "old@example.com", Host: "smtp.old.example.com", Secret: "old-secret", Port: 465, IsSSL: true} loaded, err := resolveEmailIntegrationConfig(db, legacy) if err != nil { t.Fatal(err) @@ -259,17 +258,9 @@ func TestPersistRuntimeConfigReplacesActiveStorage(t *testing.T) { nextAdmin.Local = &config.Local{StorePath: newRoot, PathPrefix: "new-files"} nextAdmin.Email = &config.Email{ To: "ops@example.com", From: "mailer@example.com", Host: "smtp.example.com", - Secret: "runtime-secret", Port: 465, IsSsl: true, + Secret: "runtime-secret", Port: 465, IsSSL: true, } - dataRaw, err := protojson.Marshal(&config.Data{}) - if err != nil { - t.Fatal(err) - } - adminRaw, err := protojson.Marshal(nextAdmin) - if err != nil { - t.Fatal(err) - } - if err = d.PersistRuntimeConfig(context.Background(), dataRaw, adminRaw); err != nil { + if err = d.PersistRuntimeConfig(context.Background(), &config.Config{Data: &config.Data{}, Admin: nextAdmin}); err != nil { t.Fatal(err) } diff --git a/internal/initialize/configuration.go b/internal/initialize/configuration.go index 8d8c65f..be4e53e 100644 --- a/internal/initialize/configuration.go +++ b/internal/initialize/configuration.go @@ -3,7 +3,8 @@ package initialize import ( "context" "encoding/json" - "errors" + "fmt" + "time" "kra/internal/config" ) @@ -34,17 +35,20 @@ func (r *Repo) SaveConfigurationJSON(ctx context.Context, raw json.RawMessage) e if err := json.Unmarshal(raw, &value); err != nil { return err } - if err := mergeJSON(value.Data, &next.Data); err != nil { + if next.Data == nil { + next.Data = &config.Data{} + } + if next.Admin == nil { + next.Admin = &config.Admin{} + } + if err := mergeDataJSON(value.Data, &next.Data); err != nil { return err } - if err := mergeJSON(value.Admin, &next.Admin); err != nil { + if err := mergeAdminJSON(value.Admin, &next.Admin); err != nil { return err } if len(value.Email) > 0 && string(value.Email) != "null" { - if next.Admin == nil { - next.Admin = &config.Admin{} - } - if err := mergeJSON(value.Email, &next.Admin.Email); err != nil { + if err := mergeEmailJSON(value.Email, &next.Admin.Email); err != nil { return err } } @@ -79,13 +83,144 @@ func mergeJSON(raw json.RawMessage, target any) error { return json.Unmarshal(raw, target) } +func mergeDataJSON(raw json.RawMessage, target **config.Data) error { + return mergeJSONMap(raw, target, func(values map[string]any) error { + if redis := jsonObject(values["redis"]); redis != nil { + if err := normalizeDuration(redis, "read_timeout", "readTimeout"); err != nil { + return err + } + if err := normalizeDuration(redis, "write_timeout", "writeTimeout"); err != nil { + return err + } + } + if items, ok := values["redis_list"].([]any); ok { + for _, item := range items { + redis := jsonObject(item) + if err := normalizeDuration(redis, "read_timeout", "readTimeout"); err != nil { + return err + } + if err := normalizeDuration(redis, "write_timeout", "writeTimeout"); err != nil { + return err + } + } + } + return nil + }) +} + +func mergeAdminJSON(raw json.RawMessage, target **config.Admin) error { + return mergeJSONMap(raw, target, func(values map[string]any) error { + moveJSONKey(values, "routerPrefix", "router_prefix") + if jwt := jsonObject(values["jwt"]); jwt != nil { + moveJSONKey(jwt, "signingKey", "signing_key") + moveJSONKey(jwt, "expiresTime", "expires_time") + moveJSONKey(jwt, "bufferTime", "buffer_time") + if err := normalizeDuration(jwt, "expires_time", "expiresTime"); err != nil { + return err + } + if err := normalizeDuration(jwt, "buffer_time", "bufferTime"); err != nil { + return err + } + } + if captcha := jsonObject(values["captcha"]); captcha != nil { + moveJSONKey(captcha, "keyLong", "key_long") + moveJSONKey(captcha, "imgWidth", "img_width") + moveJSONKey(captcha, "imgHeight", "img_height") + moveJSONKey(captcha, "storeExpiration", "store_expiration") + return normalizeDuration(captcha, "store_expiration", "storeExpiration") + } + if local := jsonObject(values["local"]); local != nil { + moveJSONKey(local, "storePath", "store_path") + moveJSONKey(local, "pathPrefix", "path_prefix") + } + if media := jsonObject(values["media"]); media != nil { + moveJSONKey(media, "sessionTtl", "session_ttl") + moveJSONKey(media, "maxFileSize", "max_file_size") + moveJSONKey(media, "chunkDir", "chunk_dir") + } + if system := jsonObject(values["system"]); system != nil { + moveJSONKey(system, "useRedis", "use_redis") + moveJSONKey(system, "useMultipoint", "use_multipoint") + moveJSONKey(system, "useStrictAuth", "use_strict_auth") + moveJSONKey(system, "disableAutoMigrate", "disable_auto_migrate") + moveJSONKey(system, "useMongo", "use_mongo") + moveJSONKey(system, "iplimitCount", "iplimit_count") + moveJSONKey(system, "iplimitTime", "iplimit_time") + } + return nil + }) +} + +func mergeEmailJSON(raw json.RawMessage, target **config.Email) error { + return mergeJSONMap(raw, target, func(values map[string]any) error { + moveJSONKey(values, "is-ssl", "is_ssl") + moveJSONKey(values, "is-loginauth", "is_login_auth") + return nil + }) +} + +func mergeJSONMap(raw json.RawMessage, target any, transform func(map[string]any) error) error { + if len(raw) == 0 || string(raw) == "null" { + return nil + } + var values map[string]any + if err := json.Unmarshal(raw, &values); err != nil { + return err + } + if transform != nil { + if err := transform(values); err != nil { + return err + } + } + normalized, err := json.Marshal(values) + if err != nil { + return err + } + return mergeJSON(normalized, target) +} + +func jsonObject(value any) map[string]any { + result, _ := value.(map[string]any) + return result +} + +func normalizeDuration(values map[string]any, keys ...string) error { + if values == nil { + return nil + } + for _, key := range keys { + raw, ok := values[key] + if !ok { + continue + } + text, ok := raw.(string) + if !ok { + return nil + } + value, err := time.ParseDuration(text) + if err != nil { + return fmt.Errorf("invalid duration %q: %w", text, err) + } + values[key] = int64(value) + return nil + } + return nil +} + +func moveJSONKey(values map[string]any, oldKey, newKey string) { + if value, ok := values[oldKey]; ok { + values[newKey] = value + delete(values, oldKey) + } +} + func managementConfig(value *config.Config) map[string]any { result := map[string]any{"data": map[string]any{}, "admin": map[string]any{}, "email": map[string]any{}} if value == nil { return result } if value.Data != nil { - result["data"] = value.Data + result["data"] = managementData(value.Data) } if value.Admin != nil { admin := value.Admin @@ -113,6 +248,36 @@ func managementConfig(value *config.Config) map[string]any { return result } +func managementData(value *config.Data) any { + if value == nil { + return map[string]any{} + } + raw, err := json.Marshal(value) + if err != nil { + return value + } + var result map[string]any + if json.Unmarshal(raw, &result) != nil { + return value + } + if redis := jsonObject(result["redis"]); redis != nil { + redis["read_timeout"] = value.Redis.ReadTimeout.String() + redis["write_timeout"] = value.Redis.WriteTimeout.String() + } + if items, ok := result["redis_list"].([]any); ok { + for index, item := range items { + if index >= len(value.RedisList) || value.RedisList[index] == nil { + continue + } + if redis := jsonObject(item); redis != nil { + redis["read_timeout"] = value.RedisList[index].ReadTimeout.String() + redis["write_timeout"] = value.RedisList[index].WriteTimeout.String() + } + } + } + return result +} + func managementJWT(value *config.JWT) any { if value == nil { return map[string]any{} @@ -336,14 +501,11 @@ func refreshDatabaseSource(database *config.Database) error { if database == nil { return nil } - if database.Driver == "sqlite" && database.Path == "" { - return errors.New("sqlite database path is required") - } - if database.Driver == "sqlite" { - database.Source = database.Path - } else { + hasStructuredConfig := database.Host != "" || database.Port != "" || database.User != "" || database.Password != "" || database.Name != "" || database.Config != "" || database.Path != "" + if hasStructuredConfig { // Driver-specific DSN construction remains in data. Clearing Source - // makes the data backend rebuild it from structured values. + // makes the data backend rebuild it from structured values, while a + // standalone DSN is preserved when no structured fields are supplied. database.Source = "" } return nil diff --git a/internal/initialize/configuration_test.go b/internal/initialize/configuration_test.go index 4a37ebe..0ab06e8 100644 --- a/internal/initialize/configuration_test.go +++ b/internal/initialize/configuration_test.go @@ -54,10 +54,10 @@ func TestConfigurationJSONMasksSecretsWithoutMutatingConfig(t *testing.T) { func TestSaveConfigurationJSONMergesPartialValuesAndPreservesSecrets(t *testing.T) { backend := &configurationBackend{value: &config.Config{ - Data: &config.Data{Database: &config.Database{Driver: "mysql", Host: "old", Password: "database-secret", Source: "old-dsn"}, Redis: &config.Redis{Name: "main", Password: "redis-secret"}}, - Admin: &config.Admin{ConfigPath: "config.yaml", JWT: &config.JWT{SigningKey: "jwt-secret", Issuer: "old"}, Email: &config.Email{Host: "old.smtp", Secret: "email-secret"}}, + Data: &config.Data{Database: &config.Database{Driver: "mysql", Host: "old", Password: "database-secret", Source: "old-dsn"}, Redis: &config.Redis{Name: "main", Password: "redis-secret", ReadTimeout: time.Second}}, + Admin: &config.Admin{ConfigPath: "config.yaml", JWT: &config.JWT{SigningKey: "jwt-secret", Issuer: "old", ExpiresTime: time.Hour}, Captcha: &config.Captcha{StoreExpiration: time.Minute}, Email: &config.Email{Host: "old.smtp", Secret: "email-secret", IsSSL: true}}, }} - raw := json.RawMessage(`{"data":{"database":{"host":"new","password":"******"}},"admin":{"jwt":{"issuer":"new","signing_key":"******"}},"email":{"host":"new.smtp","secret":"******"}}`) + raw := json.RawMessage(`{"data":{"database":{"host":"new","password":"******"},"redis":{"read_timeout":"250ms"}},"admin":{"jwt":{"issuer":"new","signingKey":"******","expiresTime":"48h"},"captcha":{"storeExpiration":"5m"}},"email":{"host":"new.smtp","secret":"******","is-ssl":false}}`) if err := (&Repo{backend: backend}).SaveConfigurationJSON(context.Background(), raw); err != nil { t.Fatal(err) } @@ -68,7 +68,23 @@ func TestSaveConfigurationJSONMergesPartialValuesAndPreservesSecrets(t *testing. if got.Data.Database.Password != "database-secret" || got.Admin.JWT.SigningKey != "jwt-secret" || got.Admin.Email.Secret != "email-secret" { t.Fatal("masked secrets were not preserved") } + if got.Data.Redis.ReadTimeout != 250*time.Millisecond || got.Admin.JWT.ExpiresTime != 48*time.Hour || got.Admin.Captcha.StoreExpiration != 5*time.Minute || got.Admin.Email.IsSSL { + t.Fatalf("management values were not decoded: redis=%s jwt=%s captcha=%s ssl=%t", got.Data.Redis.ReadTimeout, got.Admin.JWT.ExpiresTime, got.Admin.Captcha.StoreExpiration, got.Admin.Email.IsSSL) + } if got.Admin.ConfigPath != "config.yaml" { t.Fatalf("config path = %q", got.Admin.ConfigPath) } } + +func TestSaveConfigurationJSONPreservesStandaloneDSN(t *testing.T) { + backend := &configurationBackend{value: &config.Config{ + Data: &config.Data{Database: &config.Database{Driver: "mysql", Source: "user:secret@tcp(database.example:3306)/kra"}}, + Admin: &config.Admin{}, + }} + if err := (&Repo{backend: backend}).SaveConfigurationJSON(context.Background(), json.RawMessage(`{"admin":{"routerPrefix":"/api"}}`)); err != nil { + t.Fatal(err) + } + if got := backend.persisted.Data.Database.Source; got != "user:secret@tcp(database.example:3306)/kra" { + t.Fatalf("standalone DSN = %q", got) + } +} diff --git a/usage.txt b/usage.txt deleted file mode 100644 index a8c4298..0000000 --- a/usage.txt +++ /dev/null @@ -1,224 +0,0 @@ -cmd\main.go:13: "kra/internal/conf" -cmd\main.go:147: runtime := conf.NewRuntime(bc.Data, bc.Admin) -cmd\main.go:148: unsubscribeLogger := runtime.Subscribe(func(_ *conf.Data, admin *conf.AdminBackend) { -cmd\main_test.go:6: "kra/internal/conf" -cmd\wire_gen.go:16: "kra/internal/conf" -internal\app\runtime.go:30: return module.NewRuntime(contributions.Routes...) -cmd\wire.go:14: "kra/internal/conf" -pkg\module\module_test.go:54: runtime := NewRuntime(nil, stub) -pkg\mq\mqtt.go:102: return waitToken(ctx, client.Subscribe(topic, qos, func(_ paho.Client, msg paho.Message) { -pkg\module\module.go:84:func NewRuntime(routes ...RouteRegistrar) *Runtime { -internal\config\runtime_test.go:63: runtime := NewRuntime(&Config{Admin: &Admin{JWT: &JWT{SigningKey: "before"}}}) -internal\config\runtime_test.go:65: stop := runtime.Subscribe(func(value *Config) { -internal\config\runtime_test.go:69: runtime.Replace(&Config{Admin: &Admin{JWT: &JWT{SigningKey: "after"}}}) -internal\config\runtime_test.go:72: value := runtime.Snapshot() -internal\config\runtime_test.go:82: runtime := NewRuntime(&Config{Data: &Data{Database: &Database{Name: "initial"}}}) -internal\config\runtime_test.go:89: _ = runtime.Snapshot() -internal\config\runtime_test.go:94: runtime.Replace(&Config{Data: &Data{Database: &Database{Name: "next"}}}) -internal\config\runtime_test.go:111: value := runtime.Snapshot() -internal\config\runtime_test.go:117: t.Fatalf("watcher did not reload configuration: %#v", runtime.Snapshot()) -internal\config\runtime.go:56:func NewRuntime(config *Config) *Runtime { -internal\config\runtime.go:61: runtime.Replace(config) -internal\config\runtime.go:71: runtime := NewRuntime(config) -internal\config\runtime.go:87: config := r.Snapshot() -internal\config\runtime.go:95: config := r.Snapshot() -internal\config\runtime.go:103: config := r.Snapshot() -internal\config\runtime.go:111: config := r.Snapshot() -internal\config\runtime.go:122: config := r.Snapshot() -internal\config\runtime.go:155: if path := r.ConfigPath(); path != "" { -internal\config\runtime.go:200: path := r.ConfigPath() -internal\config\runtime.go:268: r.Replace(config) -internal\global\resources_test.go:61: resources := registry.Snapshot() -internal\global\resources_test.go:79: registry.Replace(Resources{ -internal\global\resources_test.go:84: resources := registry.Snapshot() -internal\global\resources_test.go:124: registry.Replace(Resources{Redis: redisClient, Storage: storage, MQ: mq, WebSocket: webSocket, Scheduler: scheduler}) -internal\global\resources_test.go:125: resources := registry.Snapshot() -internal\global\resources_test.go:144: _ = registry.Snapshot() -internal\global\resources.go:80:func (r *ResourceRegistry) Logger() *slog.Logger { return r.Snapshot().Logger } -internal\global\resources.go:86:func (r *ResourceRegistry) DB() *gorm.DB { return r.Snapshot().DB } -internal\global\resources.go:98: return r.Snapshot().NamedDBs[name] -internal\global\resources.go:106:func (r *ResourceRegistry) Redis() redis.UniversalClient { return r.Snapshot().Redis } -internal\global\resources.go:118: return r.Snapshot().NamedRedis[name] -internal\global\resources.go:126:func (r *ResourceRegistry) Mongo() *mongo.Client { return r.Snapshot().Mongo } -internal\global\resources.go:132:func (r *ResourceRegistry) Storage() FileStorage { return r.Snapshot().Storage } -internal\global\resources.go:138:func (r *ResourceRegistry) MQ() platformmq.Registry { return r.Snapshot().MQ } -internal\global\resources.go:144:func (r *ResourceRegistry) WebSocket() platformws.Hub { return r.Snapshot().WebSocket } -internal\global\resources.go:150:func (r *ResourceRegistry) Scheduler() Scheduler { return r.Snapshot().Scheduler } -internal\global\resources.go:241:func ResourceSnapshot() Resources { return defaultResources.Snapshot() } -internal\global\resources.go:243:func ReplaceResources(resources Resources) { defaultResources.Replace(resources) } -internal\conf\runtime_test.go:9: runtime := NewRuntime(&Data{Database: &Data_Database{Name: "first"}}, &AdminBackend{RouterPrefix: "/api", Jwt: &AdminBackend_JWT{SigningKey: "secret"}}) -internal\conf\runtime_test.go:25: runtime := NewRuntime(&Data{Database: &Data_Database{Name: "initial"}}, &AdminBackend{Jwt: &AdminBackend_JWT{SigningKey: "initial"}}) -internal\conf\runtime_test.go:38: runtime.Replace(&Data{Database: &Data_Database{Name: "next"}}, &AdminBackend{Jwt: &AdminBackend_JWT{SigningKey: "next"}}) -internal\conf\runtime.go:24:func NewRuntime(data *Data, admin *AdminBackend) *Runtime { -internal\conf\runtime.go:26: runtime.Replace(data, admin) -internal\conf\conf.pb.go:2216: " \x01(\tR\taccountIdB\x18Z\x16kra/internal/conf;confb\x06proto3" -internal\biz\task\task.go:236: return uc.runtime.Subscribe(userID) -internal\data\database.go:22: "kra/internal/config" -internal\data\data.go:14: "kra/internal/config" -internal\data\data.go:52: runtime *config.Runtime -internal\data\data.go:79:func (d *Data) Runtime() *config.Runtime { -internal\data\data.go:164:func NewData(runtime *config.Runtime, appLogger *slog.Logger, storageManager *storage.Reloadable, catalog module.Catalog) (*Data, func(), error) { -internal\data\data.go:256: runtime.Replace(c, admin) -internal\data\data.go:265: storageManager.Replace(activeStorage) -internal\data\data.go:327: d.runtime.UpdateDatabase(config) -internal\data\initialization_backend_test.go:10: "kra/internal/config" -internal\data\initialization_backend_test.go:81: runtime := config.NewRuntime(&config.Data{}, &config.Admin{ConfigPath: configPath}) -internal\data\config_watch_test.go:10: "kra/internal/config" -internal\data\config_watch_test.go:20: runtime := config.NewRuntime(&config.Data{}, &config.Admin{ConfigPath: configPath}) -internal\data\config_watch_test.go:24: stopListener := runtime.Subscribe(func(*config.Data, *config.Admin) { -internal\data\initialization_backend.go:9: "kra/internal/config" -internal\data\initialization_backend.go:18:func (d *Data) RuntimeValues() (*config.Data, *config.Admin) { return d.runtime.Values() } -internal\data\initialization_backend.go:61: currentData, currentAdmin := d.runtime.Values() -internal\data\initialization_backend.go:88: d.runtime.Replace(currentData, next) -internal\data\initialization_backend.go:90: d.storage.Replace(candidateStorage) -internal\data\initialization_backend.go:95: currentData, currentAdmin := d.runtime.Values() -internal\data\initialization_backend.go:125: d.runtime.Replace(nextData, nextAdmin) -internal\data\initialization_backend.go:127: d.storage.Replace(candidateStorage) -internal\data\initialization_backend.go:218: currentData, currentAdmin := d.runtime.Values() -internal\data\initialization_backend.go:228: d.runtime.Replace(currentData, currentAdmin) -internal\data\initialization_backend.go:230: d.integrations.Replace(integrationConfigs) -internal\data\integration_config.go:10: "kra/internal/config" -internal\data\integration_config_test.go:11: "kra/internal/config" -internal\data\integration_config_test.go:252: runtime: config.NewRuntime(&config.Data{}, currentAdmin), -internal\data\config_helpers.go:4: "kra/internal/config" -internal\data\config_store.go:12: "kra/internal/config" -internal\data\config_store.go:155: dataConfig, adminConfig := d.runtime.Values() -internal\data\config_store.go:214: configPath := d.runtime.ConfigPath() -internal\data\config_store.go:262: configPath := d.runtime.ConfigPath() -internal\data\config_store.go:313: configPath := d.runtime.ConfigPath() -internal\data\config_store.go:431: d.runtime.Replace(next.Data, next.Admin) -internal\data\config_store.go:433: d.integrations.Replace(integrationConfigs) -internal\data\config_store.go:436: d.storage.Replace(candidateStorage) -internal\data\config_watch.go:16: configPath := d.runtime.ConfigPath() -internal\data\config_watch.go:91: d.runtime.Replace(next.Data, next.Admin) -internal\server\gin.go:9: "kra/internal/config" -internal\server\gin.go:23:func NewGinEngine(runtime *config.Runtime, access *service.AccessControlService, handlers *handler.Set, auth *service.AuthService, security *service.SecurityService, audit *service.AuditRecorder, logger *slog.Logger, version string) *gin.Engine { -internal\server\gin.go:24: return NewGinEngineWithRuntime(runtime, access, auth, security, audit, logger, version, platformmodule.NewRuntime(router.NewRoutes(handlers)), nil) -internal\server\gin.go:27:func NewGinEngineWithRuntime(runtime *config.Runtime, access *service.AccessControlService, auth middleware.TokenAuthenticator, security *service.SecurityService, audit *service.AuditRecorder, logger *slog.Logger, version string, routes *platformmodule.Runtime, ws *websocket.Server) *gin.Engine { -internal\server\gin.go:29: runtime = config.NewRuntime(nil) -internal\server\gin.go:39: snapshot := runtime.Snapshot() -internal\server\gin_test.go:14: "kra/internal/config" -internal\server\gin_test.go:35: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "test") -internal\server\gin_test.go:69: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "test") -internal\server\gin_test.go:89: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, logger, "test") -internal\server\gin_test.go:100: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "v1.0.0") -internal\server\gin_test.go:116: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{RouterPrefix: "/admin"}}), nil, emptyHandlers(), nil, nil, nil, nil, "v1.0.0") -internal\server\gin_test.go:131: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "v1.0.0") -internal\server\gin_test.go:140: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "test") -internal\server\gin_test.go:154: engine := NewGinEngine(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, emptyHandlers(), nil, nil, nil, nil, "test") -internal\server\gin_test.go:169: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: root, PathPrefix: "uploads/file"}, Storage: &config.Storage{Type: "local"}}}) -internal\server\gin_test.go:193: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: t.TempDir(), PathPrefix: "uploads/file"}}}) -internal\server\gin_test.go:216: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: root, PathPrefix: "uploads/file"}, Storage: &config.Storage{Type: "local"}}}) -internal\server\gin_test.go:218: runtime.Replace(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: root, PathPrefix: "files"}, Storage: &config.Storage{Type: "local"}}}) -internal\server\gin_test.go:233: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: t.TempDir(), PathPrefix: "api"}, Storage: &config.Storage{Type: "local"}}}) -internal\server\gin_test.go:243: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Local: &config.Local{StorePath: t.TempDir(), PathPrefix: "uploads/file"}, Storage: &config.Storage{Type: "s3"}}}) -internal\data\integration_runtime.go:19: d.integrations.Replace(configs) -internal\data\mongo.go:9: "kra/internal/config" -internal\worker\task_scheduler_test.go:10: first := scheduler.Subscribe(1) -internal\worker\task_scheduler_test.go:11: second := scheduler.Subscribe(1) -internal\worker\task_scheduler_test.go:12: third := scheduler.Subscribe(2) -internal\worker\task_scheduler_test.go:34: channels = append(channels, scheduler.Subscribe(7)) -internal\worker\task_scheduler_test.go:60: ch := scheduler.Subscribe(9) -internal\worker\task_registry.go:10: "kra/internal/config" -internal\worker\task_registry.go:20: runtime *config.Runtime -internal\worker\task_registry.go:23:func NewTaskMethods(tasks *taskbiz.TaskUsecase, maintenance *system.MaintenanceUsecase, media *system.MediaUsecase, runtime *config.Runtime) *TaskMethods { -internal\worker\task_registry.go:58: if snapshot := methods.runtime.Snapshot(); snapshot != nil { -internal\data\payment\payment.go:411: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\server\middleware\access_log.go:18: "kra/internal/config" -internal\server\middleware\access_log.go:28:func AccessLog(runtime *config.Runtime, logger *slog.Logger, version string) gin.HandlerFunc { -internal\server\middleware\access_log.go:36: if snapshot := runtime.Snapshot(); snapshot != nil { -internal\server\staticfiles\staticfiles.go:12: "kra/internal/config" -internal\server\staticfiles\staticfiles.go:19:func Register(engine *gin.Engine, runtime *config.Runtime) { -internal\server\staticfiles\staticfiles.go:39:func Serve(c *gin.Context, runtime *config.Runtime) bool { -internal\server\staticfiles\staticfiles.go:48:func localConfig(runtime *config.Runtime) *config.Local { -internal\server\staticfiles\staticfiles.go:52: snapshot := runtime.Snapshot() -internal\server\staticfiles\staticfiles.go:76:func serveAt(c *gin.Context, runtime *config.Runtime, prefix string) bool { -internal\server\middleware\access.go:7: "kra/internal/config" -internal\server\middleware\access.go:18:func AccessControl(runtime *config.Runtime, access accessController) gin.HandlerFunc { -internal\server\middleware\access.go:33: if snapshot := runtime.Snapshot(); snapshot != nil && snapshot.Admin != nil { -internal\server\websocket_auth_test.go:12: "kra/internal/config" -internal\server\websocket_auth_test.go:47: engine := NewGinEngineWithRuntime(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, auth, nil, nil, nil, "test", nil, ws) -internal\integration\websocket\server.go:40: s.stop = store.Subscribe("websocket", ProviderMelody, func(config runtimeconfig.Config) { s.apply(config) }) -internal\server\middleware\audit.go:15: "kra/internal/config" -internal\server\middleware\audit.go:25:func OperationAudit(runtime *config.Runtime, recorder *service.AuditRecorder) gin.HandlerFunc { -internal\server\middleware\audit.go:42: if snapshot := runtime.Snapshot(); snapshot != nil && snapshot.Admin != nil && snapshot.Admin.Zap != nil && snapshot.Admin.Zap.AccessLogMaxBytes > 0 { -internal\server\middleware\cors_test.go:8: "kra/internal/config" -internal\server\middleware\cors_test.go:16: engine.Use(CORS(config.NewRuntime(&config.Config{Admin: admin}))) -internal\server\middleware\cors.go:7: "kra/internal/config" -internal\server\middleware\cors.go:20:func CORS(runtime *config.Runtime) gin.HandlerFunc { -internal\server\middleware\cors.go:26: snapshot := runtime.Snapshot() -internal\server\middleware\access_test.go:12: "kra/internal/config" -internal\server\middleware\access_test.go:39: engine.Use(AccessControl(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), &accessControllerStub{scopeErr: errors.New("database unavailable")})) -internal\server\middleware\access_log_test.go:12: "kra/internal/config" -internal\server\middleware\access_log_test.go:21: engine.Use(AccessLog(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, "test")) -internal\server\middleware\access_log_test.go:37: engine.Use(AccessLog(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, "test")) -internal\server\middleware\access_log_test.go:54: engine.Use(AccessLog(config.NewRuntime(&config.Config{Admin: &config.Admin{}}), nil, "test")) -internal\server\middleware\access_log_test.go:73: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Zap: &config.Zap{AccessReqBody: true, AccessReqHeaders: true, AccessRespData: true}}}) -internal\server\middleware\access_log_test.go:104: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{Zap: &config.Zap{AccessReqBody: true, AccessReqHeaders: true, AccessRespData: true}}}) -internal\server\middleware\access_log_test.go:130: runtime := config.NewRuntime(&config.Config{Admin: &config.Admin{}}) -internal\integration\email\email_test.go:7: "kra/internal/config" -internal\integration\email\email_test.go:11: runtime := config.NewRuntime(&config.Data{}, &config.Admin{Email: &config.Email{To: " "}}) -internal\integration\email\email_test.go:19: runtime := config.NewRuntime(&config.Data{}, &config.Admin{Email: &config.Email{Host: "smtp.example.com", From: "from@example.com", Secret: "secret", Port: 25}}) -internal\integration\email\email.go:16: "kra/internal/config" -internal\integration\email\email.go:19:type emailRepo struct{ runtime *config.Runtime } -internal\integration\email\email.go:21:func NewEmailRepo(runtime *config.Runtime) system.EmailRepo { -internal\integration\email\email.go:64: return strings.NewReplacer("\r", "", "\n", "").Replace(value) -internal\service\task\task.go:81:func (s *TaskService) Subscribe(userID uint) chan []byte { return s.uc.Subscribe(userID) } -internal\server\handler\task.go:138: events := h.service.Subscribe(claims.ID) -internal\initialize\configuration_test.go:7: "kra/internal/conf" -internal\integration\storage\tencent_storage.go:14: "kra/internal/config" -internal\initialize\configuration.go:7: "kra/internal/conf" -internal\integration\storage\s3_storage.go:12: "kra/internal/config" -internal\integration\storage\reloadable_test.go:68: reloadable.Replace(&emptyStorage{}) -internal\initialize\compatibility.go:9: "kra/internal/conf" -internal\initialize\backend.go:7: "kra/internal/conf" -internal\data\system\api_policy_test.go:9: "kra/internal/config" -internal\data\system\api_policy_test.go:23: runtime: config.NewRuntime( -internal\integration\storage\reloadable.go:10: "kra/internal/config" -internal\integration\storage\reloadable.go:18:func NewFileStorage(runtime *config.Runtime) (*Reloadable, error) { -internal\integration\storage\qiniu_storage.go:14: "kra/internal/config" -internal\integration\storage\local.go:14: "kra/internal/config" -internal\integration\storage\huawei_storage.go:11: "kra/internal/config" -internal\data\system\authority_test.go:9: "kra/internal/config" -internal\data\system\authority_test.go:17: currentData, _ := data.runtime.Values() -internal\data\system\authority_test.go:18: data.runtime.Replace(currentData, &config.Admin{System: &config.System{UseStrictAuth: true}}) -internal\integration\storage\aws_storage.go:11: "kra/internal/config" -internal\integration\storage\aliyun_storage.go:11: "kra/internal/config" -internal\integration\payment\alipay.go:439: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\integration\runtimeconfig\store_test.go:12: stop := store.Subscribe("mq", "rabbitmq", func(config Config) { updates <- config }) -internal\integration\runtimeconfig\store_test.go:36: stop := store.Subscribe("mq", "rabbitmq", func(config Config) { updates <- config }) -internal\integration\runtimeconfig\store_test.go:47: store.Replace([]Config{config}) -internal\integration\runtimeconfig\store_test.go:56: store.Replace([]Config{changed}) -internal\integration\runtimeconfig\store_test.go:70: stop := store.Subscribe("mq", "rabbitmq", func(config Config) { updates <- config }) -internal\integration\payment\allinpay.go:210: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\integration\mq\emqx.go:71: store.Subscribe("mq", ProviderEMQX, func(config runtimeconfig.Config) { r.apply(ProviderEMQX, config) }), -internal\integration\mq\emqx.go:72: store.Subscribe("mq", ProviderRabbitMQ, func(config runtimeconfig.Config) { r.apply(ProviderRabbitMQ, config) }), -internal\integration\mq\emqx.go:362: if err := client.Subscribe(context.Background(), topic, qos, r.dispatcher(provider, topic)); err != nil { -internal\integration\mq\emqx.go:445: if err := client.Subscribe(context.Background(), topic, qos, r.dispatcher(provider, topic)); err != nil { -internal\integration\payment\lakala.go:74: return strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(method))) -internal\integration\mq\emqx_test.go:57: if err := r.Subscribe(context.Background(), "orders/+/paid", platformmq.AtLeastOnce, handler); err != nil { -internal\integration\mq\emqx_test.go:204: err := r.Subscribe(context.Background(), "events.offline", platformmq.AtLeastOnce, func(context.Context, platformmq.Message) {}) -internal\integration\payment\douyin.go:113: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\data\system\log_file_test.go:11: "kra/internal/config" -internal\data\system\log_file_test.go:25: runtime := config.NewRuntime(nil, &config.Admin{Zap: &config.Zap{Director: root}}) -internal\data\system\log_file_test.go:44: runtime := config.NewRuntime(nil, &config.Admin{Zap: &config.Zap{Director: t.TempDir()}}) -internal\integration\payment\saobei.go:92: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\data\system\menu_test.go:9: "kra/internal/config" -internal\data\system\menu_test.go:23: runtime: config.NewRuntime(&config.Data{Database: &config.Database{Driver: "sqlite"}}, &config.Admin{}), -internal\integration\payment\wechat_v3.go:123: return strings.NewReplacer(".", "", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\integration\payment\wechat_v2.go:189: normalized := strings.NewReplacer(".", "_", "-", "_", " ", "_").Replace(strings.ToLower(strings.TrimSpace(value))) -internal\data\system\permission_test.go:8: "kra/internal/config" -internal\data\system\permission_test.go:19: data := &Data{gormDB: newReloadableDB(db, nil), runtime: config.NewRuntime(&config.Data{Database: &config.Database{Driver: "sqlite"}}, &config.Admin{})} -internal\data\system\permission_test.go:39: data := &Data{gormDB: newReloadableDB(db, nil), runtime: config.NewRuntime(&config.Data{Database: &config.Database{Driver: "sqlite"}}, &config.Admin{})} -internal\data\system\permission_test.go:70: data := &Data{gormDB: newReloadableDB(db, nil), runtime: config.NewRuntime(&config.Data{Database: &config.Database{Driver: "sqlite"}}, &config.Admin{})} -internal\data\system\provider.go:4: "kra/internal/config" -internal\data\system\provider.go:15: Runtime() *config.Runtime -internal\data\system\runtime.go:10: "kra/internal/config" -internal\data\system\runtime.go:16:type runtimeSettings struct{ runtime *config.Runtime } -internal\data\system\runtime.go:18:func NewRuntimeSettings(runtime *config.Runtime) system.RuntimeSettings { -internal\data\system\testing_support_test.go:10: "kra/internal/config" -internal\data\system\testing_support_test.go:19: runtime *config.Runtime -internal\data\system\testing_support_test.go:32:func (d *Data) Runtime() *config.Runtime { -internal\data\system\transactions_test.go:9: "kra/internal/config" -internal\data\system\transactions_test.go:14: name := strings.NewReplacer("/", "_", " ", "_").Replace(t.Name()) -internal\data\system\transactions_test.go:22: data := &Data{gormDB: newReloadableDB(db, nil), redis: newReloadableRedis(nil), runtime: config.NewRuntime(&config.Data{Database: &config.Database{Driver: "sqlite"}}, &config.Admin{})}