feat(migration): migrate legacy owner data and update config reference handling
- Implemented a migration process to move resources from the legacy owner "default" to the new default owner "local", ensuring no data loss during the transition.
- Updated configuration reference handling to replace legacy `$VAR_`, `$SECRET_`, and `$CONTEXT_` prefixes with mustache-style `{{ vars.name }}`, `{{ secrets.name }}`, and `{{ context.name }}`.
- Enhanced YAML configuration files and scripts to reflect the new mustache syntax, improving consistency across the application.
- Added tests to validate the migration process and ensure proper handling of legacy references.
- Updated documentation to guide users on the new configuration reference format.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Rewrite legacy `$VAR_` / `$SECRET_` / `$CONTEXT_` placeholders to mustache.
|
||||
* Safe for passwordSecret-style fields (those store bare names, not $SECRET_ prefixes).
|
||||
*
|
||||
* @param {string} text
|
||||
* @returns {{ text: string, changed: boolean }}
|
||||
*/
|
||||
export function rewriteLegacyConfigRefsInText(text) {
|
||||
if (typeof text !== "string" || text.length === 0) {
|
||||
return { text: text ?? "", changed: false };
|
||||
}
|
||||
const next = text
|
||||
.replace(/\$VAR_([A-Za-z0-9._-]+)/g, "{{ vars.$1 }}")
|
||||
.replace(/\$SECRET_([A-Za-z0-9._-]+)/g, "{{ secrets.$1 }}")
|
||||
.replace(/\$CONTEXT_([A-Za-z0-9._-]+)/g, "{{ context.$1 }}");
|
||||
return { text: next, changed: next !== text };
|
||||
}
|
||||
Reference in New Issue
Block a user