Rename plugin vars and make both colon-separated
Only one was colon separated but now they both are.
This commit is contained in:
parent
7a982555a8
commit
ddda280df4
@ -66,25 +66,23 @@ const _loadPlugins = async (pluginDir: string, httpServer: HttpServer, args: Arg
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all plugins from the `plugins` directory and the directory specified by
|
* Load all plugins from the `plugins` directory, directories specified by
|
||||||
* `PLUGIN_DIR`.
|
* `CS_PLUGIN_PATH` (colon-separated), and individual plugins specified by
|
||||||
|
* `CS_PLUGIN` (also colon-separated).
|
||||||
* Also load any individual plugins found in `PLUGIN_DIRS` (colon-separated).
|
|
||||||
* This allows you to test and develop plugins without having to move or symlink
|
|
||||||
* them into one directory.
|
|
||||||
*/
|
*/
|
||||||
export const loadPlugins = async (httpServer: HttpServer, args: Args): Promise<void> => {
|
export const loadPlugins = async (httpServer: HttpServer, args: Args): Promise<void> => {
|
||||||
|
const pluginPath = process.env.CS_PLUGIN_PATH || `${path.join(paths.data, "plugins")}:/etc/code-server/plugins`
|
||||||
|
const plugin = process.env.CS_PLUGIN || ""
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
// Built-in plugins.
|
// Built-in plugins.
|
||||||
_loadPlugins(path.resolve(__dirname, "../../plugins"), httpServer, args),
|
_loadPlugins(path.resolve(__dirname, "../../plugins"), httpServer, args),
|
||||||
// User-added plugins.
|
// User-added plugins.
|
||||||
_loadPlugins(
|
...pluginPath.split(":").map((dir) => _loadPlugins(path.resolve(dir), httpServer, args)),
|
||||||
path.resolve(process.env.PLUGIN_DIR || path.join(paths.data, "code-server-extensions")),
|
// Individual plugins so you don't have to symlink or move them into a
|
||||||
httpServer,
|
// directory specifically for plugins. This lets you load plugins that are
|
||||||
args,
|
// on the same level as other directories that are not plugins (if you tried
|
||||||
),
|
// to use CS_PLUGIN_PATH code-server would try to load those other
|
||||||
// For development so you don't have to use symlinks.
|
// directories as plugins). Intended for development.
|
||||||
process.env.PLUGIN_DIRS &&
|
...plugin.split(":").map((dir) => loadPlugin(path.resolve(dir), httpServer, args)),
|
||||||
(await Promise.all(process.env.PLUGIN_DIRS.split(":").map((dir) => loadPlugin(dir, httpServer, args)))),
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user