influxdata / vsflux

Flux language extension for VSCode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use the influxdb cli configurations for connections

rickspencer3 opened this issue · comments

It would be nice if the plugin in understood the CLI configurations so that the same settings worked across across both tools.

Thoughts on how we merge those two? Maybe a setting that allows you to toggle to one or the other? Or just put all the connections, in the cli config and in the vsflux config? How do we handle connection removals and additions?

These don't necessarily need answers, but I just wanted to list some initial thoughts from look at this issue.

CLI configs seem to live in a toml file at ~/.influxdbv2/configs by default on linux, though we may want to influx config --json instead to have an easy cross platform way to retrieve them.

As a start, perhaps we can just include them alongside the vscode defined configurations, but with the Edit Config button greyed out.

Okay, so I think I have a better grip on what this feature should look like. I welcome comments from all, though I think I'm going to get started working on this asap, to at least get some unknowns dialed in.

There should only be one source of truth
Either the internal vsflux global state or the cli configuration should be the source of truth. We should be able to implement this in a way that only changes the Store.*Instances implementations, so the rest of vsflux shouldn't know about that change in data source. The value here is that we don't have to worry about multiple code paths which, historically, have not been our strength. If we had better automated tests, that might be a different story; as it stands now, this is probably the best choice.

Using cli configs should only be done if the influx command is available
It doesn't make any sense to use the cli configs as data source if the cli doesn't actually exist. This now means there are kinda two sources of truth, but we don't have to pull from both sources simultaneously and track what came from where.

On release of this feature, existing users should be prompted to migrate.
When we release this feature, if the cli is installed, users should be prompted to migrate. This means there needs to be a config value for where the data source is, so the user can opt into this change. We probably also need a "Don't show this again" config value as well.

The user experience should not change based on data source
This is kinda the important bit, for me. Other than prompting the user for a migration, there shouldn't be a change in behavior between the two data sources.

Thoughts? Comments? Questions?

If we want just a single source of truth, then I think we should just remove the VS code configuration completely and only use the CLI config (or rather, that would just be the "influx config", no CLI qualification necessary). So just migrate the any vs code config to influx (merging where necessary) and then forget about the VS code config.