Feature: Prompt for variable value
afh opened this issue · comments
Describe the bug
envio does not prompt for variable value when told to add a variable by name only
To Reproduce
- Add a new environment variable without a value
./target/debug/envio add -e API_TOKEN test
Loading Profile
Enter your encryption key
> Enter your encryption key: ********
Error: Can not parse Environment variable
Environment variables should be in the format of KEY=VALUE
Expected behavior
The value of an environment variable managed by envio is likely to be sensitive and
having to pass the environment variable including its value on the command-line probably adds envio command to the shell history and therefore the sensitive environment variable value in plain text. This defeats the purpose of envio in way.
Therefore I'd like to be able to tell envio to add and environment variable by only specifying its name and envio will then prompt for the variable value, e.g.:
./target/debug/envio add -e API_TOKEN test
Loading Profile
Enter your encryption key
> Enter your encryption key: ********
Enter the value for API_TOKEN: MANUALLY_ENTERED_SECRET_API_TOKEN
Applying Changes
Screenshots
N/A ~~If applicable, add screenshots to help explain your problem.``
Device (please complete the following information):
- OS: macOS 14.3.1 (23D60)
- Shell: zsh
- CLI Version: 0.5.0
Additional context
Add any other context about the problem here.
This is a very nice catch! I'll make a commit in the next few hours that will hopefully fix the issue.
Thank you for letting me know
Much appreciated, @humblepenguinn, looking forward to the coming changes!
Great to see the first changes in relation to this issue in the repo, @humblepenguinn. Yet, I think it can be improved further.
If it were for me I'd keep the --env
(or use --var
) instead of --keys
as an option to the add
command.
In my mind it should be possible to pass in var=value
or just var
as an argument to --env
and envio should ask for the value in the latter case, and surely multiple --env
options should be possible:
% envio add --env DBURL=scheme://host@user:pass/database
% envio add --env API_TOKEN
Enter the value for API_TOKEN: MANUALLY_ENTERED_API_TOKEN
% envio add --env APIURL=scheme://exmaple.net/api/v1/ --env API_KEY
Enter the value for API_KEY: MANUALLY_ENTERED_API_KEY
Yeah, i switched it back to --envs
since --keys
didn't feel right. I'll re-add the option for users to also create environment variables through key value pairs.
Thank you for your suggestions @afh!