mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-10 22:20:25 +00:00
feat(task): replace built-in task adaptors with a sandboxed JS plugin system (#7076)
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/QuantumNous/new-api/middleware"
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/oauth"
|
||||
"github.com/QuantumNous/new-api/pkg/jsplugin"
|
||||
perfmetrics "github.com/QuantumNous/new-api/pkg/perf_metrics"
|
||||
"github.com/QuantumNous/new-api/relay"
|
||||
kitutil "github.com/QuantumNous/new-api/relaykit/relayconvert/kitutil"
|
||||
@@ -46,6 +47,9 @@ var buildFS embed.FS
|
||||
var indexPage []byte
|
||||
|
||||
func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "plugin" {
|
||||
os.Exit(jsplugin.RunCLI(os.Args[2:], os.Stdout, os.Stderr))
|
||||
}
|
||||
startTime := time.Now()
|
||||
kitutil.SetLogging(common.SysLog, func(message string) {
|
||||
logger.LogError(nil, message)
|
||||
@@ -107,6 +111,7 @@ func main() {
|
||||
|
||||
// 热更新配置
|
||||
go model.SyncOptions(common.SyncFrequency)
|
||||
go controller.SyncTaskPlugins()
|
||||
|
||||
// 周期性重载授权策略,保证多节点/多 master 部署下权限变更能传播到每个实例
|
||||
go authz.StartPolicySync(common.SyncFrequency)
|
||||
|
||||
Reference in New Issue
Block a user