feat: auto-update JSON template with environment params

This commit is contained in:
sokol
2026-02-18 16:04:00 +03:00
parent 7ddc8cde84
commit 7b6800de37
2 changed files with 34 additions and 2 deletions

View File

@@ -49,12 +49,14 @@ function App() {
}
return newEnvs;
});
// Also update config.envs to keep it in sync
// Also update config.envs and template to keep them in sync
setConfig(prevConfig => {
const newConfig = new Config();
newConfig.envs = prevConfig.envs.map(e => e.id === env.id ? env : e);
// Update template JSON with params from this environment
newConfig.template = prevConfig.template;
newConfig.updateTemplateFromEnv(env);
return newConfig;
});