How to use variables in forge?

I want to use variables in manifest.yaml file.
I have added below code in manifest.yaml

environment:
  variables:
    - appKey
    - connectBaseUrl
.....
remotes:
  - key: connect
    baseUrl: ${connectBaseUrl}
......
app:
  id: ari:cloud:ecosystem::app/xxxxxxxxxx
  connect:
    key: ${appKey}
    remote: connect

I am using --environment shivtest

I am setting up variables

forge variables set appKey xxxxx.xxxx
forge variables set connectBaseUrl https://xxxxxxxx.com

when i try to use

forge lint --environment shivtest

Gives below error:
0:0 error manifest.yml failed to parse content - could not find environment variable ‘appKey’ valid-yaml-required
Error: Command failed due to validation error.
Rerunning the command with --verbose may give more details.

Is this a correct way of doing thing?

I wanted to set different keys and connect urls for different environment.

Initially i tried using placeholder and then replacing using custom deploy.js script, however forge lint gives error in that case as well.

Hi @shiv ,

My guess is that your variables should be set in your shell environment when you run forge lint.

F.

1 Like

I’d try it as with tunnel: https://developer.atlassian.com/platform/forge/environments-and-versions/#forge-tunnel

previously I tried

set appKey = xxxxx.xxxx
set connectBaseUrl = https://xxxxxxxx.com

in windows command prompt.
It’s not working. however now when I removed the spaces set connectBaseUrl=https://xxxxxxxx.com
It’s working now.. Thanks