Rooyca / obsidian-api-request

Obsidian plugin that allows you to make requests to API's and receive responses in codeblocks or store them in localStorage.
https://rooyca.github.io/obsidian-api-request/
MIT License
78 stars 4 forks source link

Reusable variables defined in settings (key/value) #28

Closed elvarb closed 2 weeks ago

elvarb commented 2 weeks ago

Is your feature request related to a problem? Please describe. Many API's require the use of API Key's and to avoid having to change all instances where the key is used it would be very helpful to have the option to define variables in the plugin settings menu.

Describe the solution you'd like In the settings menu the option to define multiple custom key and value pairs where you can later reference that within a API Request code block.

Referencing the key in the code block should be done by some standardized way that does not conflict with other potential use cases.

Rooyca commented 2 weeks ago

We could use {{KEY}} for referencing the key. {{this.KEY}} for "local" values and {{KEY}} for "global" values.

Just one thing: Should be worry about security? Maybe encrypting the Keys before storing?

elvarb commented 2 weeks ago

How do you see the use of local values vs global values?

I do not think that encryption of the values should be required as these key/values can be anything really, for example an email address. Better to consider that when the need comes up but I doubt it will. This use case is more alike to putting the secret key into an application config file or hardcoded into the source code for an internal application, its not best practice but sometimes necessary as it is the only option. Each user is responsible for evaluate the risk of putting sensitive information into Obsidian.

Rooyca commented 2 weeks ago

How do you see the use of local values vs global values?

Local = front-matter values that can only be access withing the file. Global = values that can be use in all the files.

Each user is responsible for evaluate the risk of putting sensitive information into Obsidian.

Yeah, you're right.