@gearbox-protocol/cli-utils 5.36.21 → 5.36.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import getPromisePath from "./getPromisePath.js";
8
8
  * e.g. ${KEY} or ${KEY.SUBKEY}
9
9
  *
10
10
  */
11
- const templateKeyRegex = /^\$\{(?:[\w-]+(?:\.[\w-]+)*)\}$/;
11
+ const templateKeyRegex = /\$\{(?:[\w-]+(?:\.[\w-]+)*)\}/g;
12
12
  /**
13
13
  * Merges yaml files, respecting .extends references.
14
14
  * Performs env variable substitution on the config.
@@ -62,12 +62,17 @@ export async function resolveYamlDoc(file, templateData) {
62
62
  }
63
63
  await YAML.visitAsync(cfgRaw, {
64
64
  Scalar: async (_, node) => {
65
- if (typeof node.value === "string" && templateKeyRegex.test(node.value)) {
66
- const templateKey = node.value.slice(2, -1);
67
- const templateValue = getPromisePath(templateData, templateKey);
68
- if (templateValue) {
69
- node.value = await Promise.resolve(templateValue);
65
+ if (typeof node.value === "string") {
66
+ let val = node.value;
67
+ const matches = val.matchAll(templateKeyRegex);
68
+ for (const match of matches) {
69
+ const templateKey = match[0].slice(2, -1);
70
+ const templateValue = await getPromisePath(templateData, templateKey);
71
+ if (templateValue) {
72
+ val = val.replace(match[0], templateValue);
73
+ }
70
74
  }
75
+ node.value = val;
71
76
  }
72
77
  },
73
78
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/cli-utils",
3
3
  "description": "Utils for creating cli apps",
4
- "version": "5.36.21",
4
+ "version": "5.36.22",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"