fix: preserve existing plugin config on install
This commit is contained in:
15
install.mjs
15
install.mjs
@@ -343,12 +343,21 @@ async function configure() {
|
||||
|
||||
const plugins = getOpenclawConfig('plugins', {});
|
||||
plugins.entries = plugins.entries || {};
|
||||
|
||||
const existingEntry = plugins.entries[PLUGIN_NAME] || {};
|
||||
const existingConfig = existingEntry.config || {};
|
||||
const defaultConfig = { enabled: true, secretMgrPath, openclawProfilePath: openclawPath };
|
||||
|
||||
plugins.entries[PLUGIN_NAME] = {
|
||||
enabled: true,
|
||||
config: { enabled: true, secretMgrPath, openclawProfilePath: openclawPath },
|
||||
...existingEntry,
|
||||
enabled: existingEntry.enabled ?? true,
|
||||
config: {
|
||||
...defaultConfig,
|
||||
...existingConfig,
|
||||
},
|
||||
};
|
||||
setOpenclawConfig('plugins', plugins);
|
||||
logOk('Plugin entry configured');
|
||||
logOk('Plugin entry configured (preserved existing config, added missing defaults)');
|
||||
} catch (err) {
|
||||
logWarn(`Config failed: ${err.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user