deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

Expand environmental variables in sshOpts

Open nrdxp opened this issue 4 years ago • 4 comments

For now only bracket style expansion is enabled, i.e. ${MY_VAR}. I had issues with expanding $MY_VAR in a path string, and so excluded that usecase to avoid errors. One can specify brackets in a Nix string by escaping the $, e.g. "\${NOT_EXPANDED_BY_NIX}".

This doesn't work in '' stype strings and requires a bit more magic: ''${"\${NOT_EXPANDED_BY_NIX}"}'' https://github.com/serokell/deploy-rs/pull/116#issuecomment-896640019

nrdxp avatar Aug 10 '21 22:08 nrdxp

This doesn't work in '' stype strings and requires a bit more magic: ''${"${NOT_EXPANDED_BY_NIX}"}''

Actually, just

nix-repl> ''''${NOT_EXPANDED_BY_NIX}''
"${NOT_EXPANDED_BY_NIX}"

balsoft avatar Aug 11 '21 09:08 balsoft

@notgne2, it may just be the library I used, but I have a shell that detects the flake root directory using git rev-parse --show-toplevel when trying to set just "$FLAKE_ROOT/path/to/key" it expanded to an empty string somehow :shrug:

There is probably a similar crate, or maybe I could look at the source, and just reimplement a more minimal version or something.

@balsoft, thanks for the tip!

nrdxp avatar Aug 11 '21 15:08 nrdxp

Maybe this function or part of it can also be hammered into shape to be useful for parsing the cli string into a Vector via the parse(try_from_str = parse_key_val) attribute.

That's the last piece missing (on my todo list) for homogenization of data structures.

Can we merge?

blaggacao avatar Aug 11 '21 15:08 blaggacao

Can you merge?

blaggacao avatar Aug 26 '21 19:08 blaggacao