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

Allow defining the env-like vars for inside the PHAR #890

Open
dkarlovi opened this issue Feb 27, 2023 · 2 comments
Open

Allow defining the env-like vars for inside the PHAR #890

dkarlovi opened this issue Feb 27, 2023 · 2 comments
Milestone

Comments

@dkarlovi
Copy link

dkarlovi commented Feb 27, 2023

Feature Request

(we wrote about this in detail on Symfony Slack yesterday)

The idea is to provide a way for the user to define some vars in box.json which would then be available in the env for the PHAR when running it.

One example is needing to define APP_ENV to the read-only Symfony environment, which I solved in the autoload template which is currently required (I don't use DotEnv).

Another example would be APP_RUNTIME, enabling the PHAR runtime.

Dockerfile has a similar idea with the ENV instruction.

Example usage

{
    "env": {
        "APP_ENV": "my-custom-prod-env",
        "APP_RUNTIME": "Runtime\\PHAR\\Runtime"
    }
}

When the PHAR runs, it should see these values defined in the env as if they're real env vars.

@dkarlovi
Copy link
Author

Thinking about this, I'm pretty sure these should be fixed: even if user passes APP_ENV to the PHAR, the embedded one should still be used. This means the user can't break the PHAR by passing APP_ENV=dev.

@danepowell
Copy link
Contributor

danepowell commented Mar 23, 2023

I'd like to use this to pass semi-sensitive credentials as environment variables at runtime. The existing sigil / replacement functionality can be used for this but has problems of its own, such as breaking static analysis and being somewhat unpredictable (if people accidentally use a magic string where they shouldn't).

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

No branches or pull requests

3 participants