diff --git a/config-raw.json b/config-raw.json index b43345f7b..fabdadbfd 100644 --- a/config-raw.json +++ b/config-raw.json @@ -1049,6 +1049,11 @@ "key": "dir", "default_value": "plugins", "comment": "The directory where plugins are stored." + }, + { + "key": "loader", + "default_value": "native", + "comment": "The plugin loader to use. \"yaegi\" loads plugins from Go source files (directories of .go files). \"native\" (deprecated) loads compiled Go plugin shared libraries (.so files)." } ] } diff --git a/pkg/config/config.go b/pkg/config/config.go index f57248242..af529b757 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -230,6 +230,7 @@ const ( PluginsEnabled Key = `plugins.enabled` PluginsDir Key = `plugins.dir` + PluginsLoader Key = `plugins.loader` ) var maxFileSizeInBytes uint64 @@ -484,6 +485,7 @@ func InitDefaultConfig() { // Plugins PluginsEnabled.setDefault(false) PluginsDir.setDefault(ResolvePath("plugins")) + PluginsLoader.setDefault("native") // Migrate deprecated webhook config keys to outgoingrequests.* // This allows removing the old keys in a single place later. @@ -657,6 +659,10 @@ func InitConfig() { RateLimitStore.Set(KeyvalueType.GetString()) } + if loader := PluginsLoader.GetString(); loader != "yaegi" && loader != "native" { + log.Fatalf("Invalid value for plugins.loader: %q (must be \"yaegi\" or \"native\")", loader) + } + if CorsEnable.GetBool() && ServicePublicURL.GetString() == "" { log.Fatalf("service.publicurl is required when cors.enable is true") } diff --git a/pkg/initialize/init.go b/pkg/initialize/init.go index a614da182..7c70609ce 100644 --- a/pkg/initialize/init.go +++ b/pkg/initialize/init.go @@ -34,6 +34,7 @@ import ( "code.vikunja.io/api/pkg/modules/keyvalue" migrationHandler "code.vikunja.io/api/pkg/modules/migration/handler" "code.vikunja.io/api/pkg/plugins" + _ "code.vikunja.io/api/pkg/plugins/yaegi" // register yaegi plugin loader "code.vikunja.io/api/pkg/red" "code.vikunja.io/api/pkg/user" )