mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 20:26:26 +08:00

- Added driver initialization for gRPC plugins in internal/bootstrap/driver.go. - Introduced configuration structures and protobuf definitions for driver plugins in proto/driver/config.proto and proto/driver/driver.proto. - Implemented gRPC server and client interfaces for driver plugins in shared/driver/grpc.go. - Created common response handling utilities in server/common/common.go and server/common/resp.go. - Developed plugin registration endpoint in server/handles/plugin.go. - Added test cases for plugin functionality in shared/driver/plugin_test.go. - Defined plugin reattachment configuration model in shared/model/plugin.go.
43 lines
807 B
Go
43 lines
807 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/OpenListTeam/OpenList/v5/cmd/flags"
|
|
"github.com/OpenListTeam/OpenList/v5/internal/bootstrap"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func Init(ctx context.Context) {
|
|
if flags.Dev {
|
|
flags.Debug = true
|
|
}
|
|
initLogrus()
|
|
bootstrap.InitConfig()
|
|
bootstrap.InitDriverPlugins()
|
|
}
|
|
|
|
func Release() {
|
|
|
|
}
|
|
|
|
func initLog(l *logrus.Logger) {
|
|
if flags.Debug {
|
|
l.SetLevel(logrus.DebugLevel)
|
|
l.SetReportCaller(true)
|
|
} else {
|
|
l.SetLevel(logrus.InfoLevel)
|
|
l.SetReportCaller(false)
|
|
}
|
|
}
|
|
func initLogrus() {
|
|
formatter := logrus.TextFormatter{
|
|
ForceColors: true,
|
|
EnvironmentOverrideColors: true,
|
|
TimestampFormat: "2006-01-02 15:04:05",
|
|
FullTimestamp: true,
|
|
}
|
|
logrus.SetFormatter(&formatter)
|
|
initLog(logrus.StandardLogger())
|
|
}
|