This message was deleted.
# typescript
s
This message was deleted.
f
Copy code
let config = {}
if (env === "qa" || env === "prod" || env === "dev") {
  azure.keyvault
    .getKeyVault({
      name: "name",
      resourceGroupName: "rg-name",
    })
    .then((vault) => {
      return azure.keyvault.getSecret({
        keyVaultId: vault.id,
        name: "secretname",
      });
    })
    .then((secret) => {
      const secret = secret.value;

      config = {
        secret: secret,
      };
    });
}

console.log(config);
This is my code..
f
I don't think this would work because of the way Javascript/TypeScript handles asynchronous code. In your example,
console.log(config)
ends up running before the
azure.keyvault
chained promise.
Does the
azure.keyvault
top level Promise return anything? If so, you can assign that return value to a variable and output that. IE
Copy code
let config = {}
if (env === "qa" || env === "prod" || env === "dev") {
  const helloThere = azure.keyvault
    .getKeyVault({
      name: "name",
      resourceGroupName: "rg-name",
    })
    .then((vault) => {
      return azure.keyvault.getSecret({
        keyVaultId: vault.id,
        name: "secretname",
      });
    })
    .then((secret) => {
      const secret = secret.value;

      config = {
        secret: secret,
      };
    });
}

console.log(helloThere.<property>);