Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String replacement using environment variable #5948

Closed
Bartheleway opened this issue Nov 15, 2024 · 4 comments
Closed

String replacement using environment variable #5948

Bartheleway opened this issue Nov 15, 2024 · 4 comments

Comments

@Bartheleway
Copy link

Summary

We use to deploy our source to dev sandbox using right click -> deploy source to org. Having setup replacement strings, they take their value from environment variables.

Setting environment variable at OS session level feels awkward. I tried to set them up to test but it didn't find them. Probably because I didn't logout/login nor restart VS Code so probably env variables were not reloaded.

Steps To Reproduce:

  1. Create a sf project
  2. Setup sfdx-project.json to use replacement strings and source their value with env vars
  3. Right click on a file that is covered by a replacement string and deploy source to org

Expected result

Ask for env var value when not found?

Actual result

Command fails

Salesforce Extension Version in VS Code: 62.5.1

Salesforce CLI Version: 2.65.8

OS and version: Windows 10 Pro 22H2

VS Code version: 1.95.3

Most recent version of the extensions where this was working: N/A

@svc-idee-bot
Copy link
Collaborator

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@daphne-sfdc
Copy link
Contributor

Hi @Bartheleway, To make sure I understand this issue correctly - are you trying to do something like this? You modified your sfdx-project.json to use OS-level environment variables?

sfdx-project.json

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true,
      "package": "${PACKAGE_NAME}",
      "versionName": "${VERSION_NAME}",
      "versionNumber": "${VERSION_NUMBER}"
    }
  ],
  "namespace": "",
  "sourceApiVersion": "61.0",
  "packageAliases": {
    "DreamhouseLWC": "0Ho3h000000PBghCAG",
    "[email protected]": "04t3h000001RcBxAAK",
    "[email protected]": "04tKY000000LOv6YAG",
    "[email protected]": "04tKY000000LP3aYAG"
  }
}

.zshrc

export PACKAGE_NAME=DreamhouseLWC
export VERSION_NAME="Summer '24"
export VERSION_NUMBER=61.0.0.NEXT

Copy link

This issue has not received a response in 3 days. It will auto-close in 2 days unless a response is posted.

@github-actions github-actions bot added the stale label Nov 29, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2024
@Bartheleway
Copy link
Author

Bartheleway commented Dec 1, 2024

Well not exactly I'm using this : https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_string_replace.htm

Using the replaceWithEnv option.

Which means every replacement vars are declared in the .json file and can be parsed and then asked when not defined during deploy process by the extension.

(auto closing after 3 days after waiting 10 days for first response ... I would apprieciate having some time to respond)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants