codeium.vim icon indicating copy to clipboard operation
codeium.vim copied to clipboard

API Key Flexibility and Duplication

Open trueNAHO opened this issue 1 year ago • 0 comments

Issue

Adding codeium.vim to my currently flawless codeium.nvim setup introduces two compatibility issues. Namely, there seems to be no way to modify the location of the configuration file storing the API key, and the API key is duplicated in the configuration file.

My encryption-based setup decrypts the configuration file storing the API key to /run/user/<UID>/<FILE>. In codeium.nvim, I specify the path to this file with its config_path option. However, codeium.vim does not seem to have an equivalent option, decreasing the security level of my setup. My current hacky workaround is to symlink to the /run/user/<UID>/<FILE> file (at some point). Sadly, this is suboptimal because the path is implicitly related instead of logically bound to the (N)VIM configuration file, leading to potential configuration drifts.

Additionally, the API key needs to be duplicated in codeium.nvim's api_key and codeium.vim's apiKey JSON entry. If this is an intentional feature, then I don't mind duplicating one JSON entry, although I cannot think of a use case for using different API keys for codeium.nvim and codeium.vim. Nevertheless, both plugins could use a common api_key entry by default with more specialised nvim_api_key and vim_api_key entries for users intending to use different API keys.

Relevant Implementation Insights

codeium.nvim

The config_path option is documentated as follows:

  • https://github.com/Exafunction/codeium.nvim/blob/f871000e91faa9ed334da2bfa4eadbf54d0e1047/README.md?plain=1#L71

The config_path defaults to the following:

  • https://github.com/Exafunction/codeium.nvim/blob/f871000e91faa9ed334da2bfa4eadbf54d0e1047/lua/codeium/config.lua#L3-L16

The api_key is saved with:

  • https://github.com/Exafunction/codeium.nvim/blob/f871000e91faa9ed334da2bfa4eadbf54d0e1047/lua/codeium/api.lua#L58-L65

The api_key is loaded with:

  • https://github.com/Exafunction/codeium.nvim/blob/f871000e91faa9ed334da2bfa4eadbf54d0e1047/lua/codeium/api.lua#L41-L56

codeium.vim

The following code snippets demonstrate that codeium.vim's JSON entry is called apiKey:

  • https://github.com/Exafunction/codeium.vim/blob/a1c3d6b369a18514d656dac149de807becacbdf7/autoload/codeium/command.vim#L43
  • https://github.com/Exafunction/codeium.vim/blob/a1c3d6b369a18514d656dac149de807becacbdf7/autoload/codeium/command.vim#L129

Related

  • https://github.com/Exafunction/codeium.vim/issues/24
  • https://github.com/Exafunction/codeium.vim/issues/290
  • https://github.com/Exafunction/codeium.vim/issues/35
  • https://github.com/Exafunction/codeium.vim/pull/116
  • https://github.com/Exafunction/codeium.vim/pull/292
  • https://github.com/Exafunction/codeium.vim/pull/40

trueNAHO avatar Jan 18 '24 23:01 trueNAHO