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

Add CLI support for bulk environment variables #1084

Closed
bketelsen opened this issue Aug 7, 2024 · 2 comments
Closed

Add CLI support for bulk environment variables #1084

bketelsen opened this issue Aug 7, 2024 · 2 comments
Labels
Easy Good for new contributors Feature New feature, not a bug
Milestone

Comments

@bketelsen
Copy link
Contributor

Required information

  • Distribution: debian
  • Distribution version: bookworm
    • Incus version: 6.3 daily

Feature Request

I've really been enjoying the OCI container support in Incus. In the process of moving my self-hosting bits from docker-compose to incus one thing that I've noticed is how much more typing it is to add -c environment.MYVAR=myvalue to the command line. I'm proposing adding a command line flag to the init/create and launch subcommands that will read environment variables from a file in standard KEY=value format, one pair per line.

Example

Given a file called .env with values:

MYSQL_PASSWORD=youruncle
MYSQL_USER=bob

Incus command could look like this:

incus init docker:mysql:latest --env .env

The command logic would read the lines from the .env file and merge them into the configuration before init/create/launch.

If acceptable, I'm willing to make this change as a pull request.

Thanks for incus!

@bketelsen
Copy link
Contributor Author

Flag name --env is of course up for debate, but it appears that --env is available.

@stgraber stgraber added Feature New feature, not a bug Easy Good for new contributors labels Aug 7, 2024
@stgraber stgraber added this to the soon milestone Aug 7, 2024
@stgraber stgraber changed the title Feature Request: .env support Add CLI support for bulk environment variables Aug 7, 2024
@stgraber
Copy link
Member

stgraber commented Aug 7, 2024

I think that's fine, though I'd go for the longer --environment-file, a bit more of a pain to type (though that's what shell completion is for :)) but also more descriptive of what it will do.

stgraber pushed a commit to bketelsen/incus that referenced this issue Aug 8, 2024
@stgraber stgraber modified the milestones: soon, incus-6.4 Aug 8, 2024
stgraber pushed a commit that referenced this issue Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Good for new contributors Feature New feature, not a bug
Development

No branches or pull requests

2 participants