mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 19:40:40 +00:00
16 lines
373 B
TypeScript
16 lines
373 B
TypeScript
import type { OpenClawConfig } from "./config.js";
|
|
|
|
export function ensurePluginAllowlisted(cfg: OpenClawConfig, pluginId: string): OpenClawConfig {
|
|
const allow = cfg.plugins?.allow;
|
|
if (!Array.isArray(allow) || allow.includes(pluginId)) {
|
|
return cfg;
|
|
}
|
|
return {
|
|
...cfg,
|
|
plugins: {
|
|
...cfg.plugins,
|
|
allow: [...allow, pluginId],
|
|
},
|
|
};
|
|
}
|