@@ -66,25 +66,23 @@ const _loadPlugins = async (pluginDir: string, httpServer: HttpServer, args: Arg
66
66
}
67
67
68
68
/**
69
- * Load all plugins from the `plugins` directory and the directory specified by
70
- * `PLUGIN_DIR`.
71
-
72
- * Also load any individual plugins found in `PLUGIN_DIRS` (colon-separated).
73
- * This allows you to test and develop plugins without having to move or symlink
74
- * them into one directory.
69
+ * Load all plugins from the `plugins` directory, directories specified by
70
+ * `CS_PLUGIN_PATH` (colon-separated), and individual plugins specified by
71
+ * `CS_PLUGIN` (also colon-separated).
75
72
*/
76
73
export const loadPlugins = async ( httpServer : HttpServer , args : Args ) : Promise < void > => {
74
+ const pluginPath = process . env . CS_PLUGIN_PATH || `${ path . join ( paths . data , "plugins" ) } :/etc/code-server/plugins`
75
+ const plugin = process . env . CS_PLUGIN || ""
77
76
await Promise . all ( [
78
77
// Built-in plugins.
79
78
_loadPlugins ( path . resolve ( __dirname , "../../plugins" ) , httpServer , args ) ,
80
79
// User-added plugins.
81
- _loadPlugins (
82
- path . resolve ( process . env . PLUGIN_DIR || path . join ( paths . data , "code-server-extensions" ) ) ,
83
- httpServer ,
84
- args ,
85
- ) ,
86
- // For development so you don't have to use symlinks.
87
- process . env . PLUGIN_DIRS &&
88
- ( await Promise . all ( process . env . PLUGIN_DIRS . split ( ":" ) . map ( ( dir ) => loadPlugin ( dir , httpServer , args ) ) ) ) ,
80
+ ...pluginPath . split ( ":" ) . map ( ( dir ) => _loadPlugins ( path . resolve ( dir ) , httpServer , args ) ) ,
81
+ // Individual plugins so you don't have to symlink or move them into a
82
+ // directory specifically for plugins. This lets you load plugins that are
83
+ // on the same level as other directories that are not plugins (if you tried
84
+ // to use CS_PLUGIN_PATH code-server would try to load those other
85
+ // directories as plugins). Intended for development.
86
+ ...plugin . split ( ":" ) . map ( ( dir ) => loadPlugin ( path . resolve ( dir ) , httpServer , args ) ) ,
89
87
] )
90
88
}
0 commit comments