obsidian-bridge.nvim icon indicating copy to clipboard operation
obsidian-bridge.nvim copied to clipboard

Feat: Option to change API key env variable name

Open ficd0 opened this issue 1 year ago • 3 comments

I noticed that the API key environment variable name isn't actually hard-coded:

-- config.lua
local api_key = os.getenv(M.api_key_env_var_name)

I think it would be nice if the currently required environment variable, OBSIDIAN_REST_API_KEY, was instead a default that the user can change should they wish. I propose an optional configuration option that the user can pass during plugin setup.

I can add this in a separate PR once I am done working on #27 .

ficd0 avatar Dec 06 '24 03:12 ficd0

That sounds great, if you want some inspiration personally I'm impressed by how gp.nvim manages its API key https://github.com/Robitx/gp.nvim?tab=readme-ov-file#2-openai-api-key

oflisback avatar Dec 10 '24 19:12 oflisback

Hmm, I wonder if that may be a bit too complex for this use case? Since the environment variable's name is already a "variable", all we'd need is to accept user config option to change it (and have its current name as the default option). I'll implement this next week and submit a PR.

ficd0 avatar Dec 13 '24 23:12 ficd0

I agree that sounds like a nice improvement. :+1:

oflisback avatar Dec 14 '24 11:12 oflisback