Skip to content

Evaluate environment variables in local plugin path #2638

Closed
@adamjreed

Description

@adamjreed

What problem are you trying to solve?

My company is looking at adopting devbox as a package manager and orchestrator for running our services locally. I'd like to accomplish this by setting up a global devbox file that will be version controlled and then using plugins to define various services in the actual repos where each service lives.

Where I ran into a problem is that we don't guarantee the location of source code on each individual's development machine, so we can't set a relative or absolute path in the version controlled global file and guarantee it to work for everyone.

I wanted to solve this by defining an environment variable like $SRC_DIR that could be used in plugin paths in the global file like this:

"include": [
    "path:$SRC_DIR/app/devbox/plugin.json"
    "path:$SRC_DIR/otherapp/devbox/plugin.json"
]

The problem I ran into is that it looks like environment variables aren't currently evaluated as part of the local plugin path resolution so this results in devbox treating this as a relative path but including the env var verbatim as well. That results in an error like this:

Error: open /Users/user/.local/share/devbox/global/default/$SRC_DIR/app/devbox/plugin.json: no such file or directory

I think there's a quick fix for this so I'll also submit a PR to propose a solution. Thanks for considering!

What solution would you like?

Evaluate environment variables when assembling the path for local plugins.

Alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requesttriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions