nexmo-cli icon indicating copy to clipboard operation
nexmo-cli copied to clipboard

Add per project CLI configuration

Open cbetta opened this issue 9 years ago • 3 comments

This config could hold:

  • Preferred URL host
  • App key

Related issues:

  • https://github.com/Nexmo/nexmo-cli/issues/114
  • https://github.com/Nexmo/nexmo-cli/issues/109
  • https://github.com/Nexmo/nexmo-cli/issues/51

Gut feeling says we can put this in the local .nexmorc we are already looking for

cbetta avatar Jan 24 '17 12:01 cbetta

Changes to be made:

  • [ ] Update config loading to check BOTH local and global .nexmorc. This way we could have API keys in ~/.nexmorc and host settings in the local ./.nexmorc.
  • [ ] Add a way to write new config to local or global files.
    • [ ] Set: nexmo config:set key=value
    • [ ] Unset: nexmo config:unset key
    • [ ] List: nexmo config
    • [ ] Get: nexmo config:get key
    • [ ] Global: nexmo config:set key=value -g
  • [ ] Use config to set/apply environment selection (see #114)
  • [ ] Use config to set/apply default pagination size (see #51)
  • [ ] Use this config to potentially store details about keys (tbd, see #109)

cbetta avatar Jan 31 '17 17:01 cbetta

Remaining questions:

  • Currently nexmo setup writes to a global file, and nexmo setup --local to a local file. This would be opposite to nexmo config:set as proposed.
  • What should be done if there's no global file but there is a local file and someone sets new config?

cbetta avatar Jan 31 '17 17:01 cbetta

API key and secret are account level credentials where as application ID and public/private keys are Nexmo application level config entities. Page size is a CLI specific thing. This proposed solution is suggesting adding a way of overwriting account/global config at an application level and also allows some CLI config to be set in the same place 🤔

I'm a little concerned about merging account, CLI config, environment/API host config and application config. Should they be very clearly separated?

My feeling is that we keep #109 focused on application config and separate from this issue. I do think this issue can address account, CLI and environment config.

What should be done if there's no global file but there is a local file and someone sets new config?

Consistency suggests that config:set should default to global unless a --local flag is passed. Maybe the CLI could warn if config:set is called and there is local config?

leggetter avatar Feb 03 '17 11:02 leggetter