Skip to content

Feature Request: Support .env environment variable expansion in settings.json #140

@xiaoyao9184

Description

@xiaoyao9184

Hi, thanks for your work on this extension!

I'm currently using direnv to load environment variables from .env files, which are automatically exported into my shell session. I’d like to keep remote host paths and other sensitive config values out of settings.json (and out of Git), and instead reference them via environment variables.

Right now, it seems that settings.json does not support reading from environment variables (e.g., ${env:SYNC_REMOTEPATH} or similar). This makes it difficult to integrate with .env workflows already used by other tools like tasks.json, which does support environment variable substitution.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "direnv",
            "type": "shell",
            "command": "echo ${env:SYNC_REMOTEPATH}"
        },

Proposal:

Support expanding ${env:VAR_NAME} or similar syntax in settings.json.

Alternatively, allow loading .env files directly within this extension's configuration logic (if possible).

SYNC_REMOTEPATH=user1@server1:/path1/
{
    "sync-rsync.sites": [
        {
            "localPath": "${workspaceFolder}/",
            "remotePath": "${env:SYNC_REMOTEPATH}"
        }
    ]
}

This would allow for more flexible and secure setups, especially in teams or OSS projects where you don't want to leak hostnames, usernames, or remote paths.

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions