fnproject/cli

[feature-request] read config var from file

Opened this issue · 3 comments

Private key content handling is not quite easy for the cases when there's a need for setting the key content as a configuration variable.

here's a simple bash script:

cat $(cat ~/.oci/config | grep key_file | awk '{split($0,array,"=")} END{print array[2]}')

i can use this script to set an env var:

export OCI_PRIVATE_KEY=`cat $(cat ~/.oci/config | grep key_file | awk '{split($0,array,"=")} END{print array[2]}')`

with this var I'd like to set a function's config var:

fn config fn oci list-instances OCI_PRIVATE_KEY ${OCI_PRIVATE_KEY}

unfortunately it fails due to the nature of the PEM key file:

Fn: bad flag syntax: -----BEGIN

See 'fn <command> --help' for more information. Client version: 0.5.40

This makes me think that it would be nice to have a feature that will help to read private key files as config var without actually doing all of these scripting manipulations.

Would a flag like --from-file make this better? Might be easier than parsing the input for ${}.

Hi, as I mentioned in a description, any feature that will make UX better is appreciated.

So, I’d say make the CLI be capable to read an app/function config option value from a file.

I'll take a look at this today probably. Need to see if there are any other places in the CLI that could benefit from this.