Skip to content

cargo-lambda and cargo --config command line overrides #335

@jesjos

Description

@jesjos

Thanks for writing cargo-lambda!

This might be documentation issue or a only-affects-rust-beginners-thing or maybe a new feature, but I was thrown off by cargo-lambda and cargo --config i.e. command-line overrides.

Just looking at the cargo docs, one gets the impression that custom cargo subcommands would leverage cargo's own handling of configuration, and thus be able to use config overrides too. But having tried this out and (and finally – read the source for cargo and cargo-lambda), I realize this is not the case.

My use case is that my lambda requires some file paths in the form of environment variables to run correctly. During development, these paths might differ on different developer workstations. So hard-coding them in Cargo.toml won't do. I tried injecting them using something like this:

cargo --config 'package.metadata.lambda.env.WORKING_DIRECTORY = "/foobar"'  lambda watch

But obviously, this won't work.

Perhaps it might make sense to explicitly mention this in the cargo-lambda docs?

If it'd be possible to offer this override functionality, it would be super useful to me. I want to try and offer a PR for it, but in all honesty it seems a bit too complicated for my limited Rust skills.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions