jfrog / jfrog-vscode-extension

JFrog VS-Code Extension
https://jfrog.github.io/jfrog-vscode-extension
Apache License 2.0
189 stars 34 forks source link

How do I save the extension settings in settings.json? #93

Open red8888 opened 3 years ago

red8888 commented 3 years ago

Why are there no examples of how to configure this in settings.json? I have to configure the extension every time

What are the values I can put in settings.json so I dont need to login every time?

yahavi commented 3 years ago

@red8888 Thanks for reporting this issue. The extension saves Xray URL as jfrog.xray.url and the username as jfrog.xray.username. However, the password is saved only in the system's password manager, like KeyChain in MacOS. Saving the password in settings.json is too risky, and therefore configuring the connection details by settings.json is not possible.

Once you configure the connection details using the connect button, and the details should be stored forever. Have you asked every time to reconfigure them?


To automate this process for many machines, you can follow do the following:

  1. Export JFROG_IDE_URL, JFROG_IDE_USERNAME, and JFROG_IDE_PASSWORD environment variables.
  2. Install JFrog VS-Code extension by the command line or by the UI. The credentials will automatically be saved in the file system. Xray URL and username will be stored in global VS-Code storage. The password will be stored in the operating system's key storage service. For security reasons, you may be requested to prompt user's password once. I believe that there are ways to avoid this prompt once, depending on the OS.

You can read more about these environment variables in the README.

Please let me know if it helped.

red8888 commented 3 years ago

The extension saves Xray URL as jfrog.xray.url and the username as jfrog.xray.username

Where does it save these settings? I dont see anything in my settings.json

Basically I want to make this as easy as possible for our users to setup

If the process is something like this it would be good:

  1. Install extension
  2. Connect via UI in some project
  3. All settings are then saved in settings.json and keychain
  4. Now all future projects you open are now setup automatically- and you don't need to login again or configure anything or add environment variables to your bashrc, etc

This is not the behaviour I'm seeing though

yahavi commented 3 years ago

@red8888, Thanks for your feedback!

The process of connecting via UI is actually the basic use case, and it definitely should be supported.

The storing process is as following:

  1. Connect to JFrog Xray as demonstrated here: connect
  2. The URL and the username are stored in VS-Code Global State, the password stored in the password manager.

The retrieval process is as following:

  1. Open VS-Code.
  2. The URL and the username retrieved from the Global State, the password is loaded from the password manager.

The Global State is actually a binary file stored in the global VS-Code configuration. For example in MacOS, this file can be found under: /Users/<username>/Library/Application Support/Code/User/globalStorage/state.vscdb

One possible pitfall: The VS-Code has to be properly installed to enable the VS-Code storage - simply running the VS-Code executable will not work. For example, in MacOS you may download and run the Visual Studio Code.app file, however in order to make sure the VS-Code runs properly, you have to move this file to the Applications folder.

If after a successful connection, the credentials are not retrieved after VS-Code reload, please provide more information about your system and we'll test and investigate. The information should include at least:

  1. The plugin's version
  2. OS version
  3. VS-Code version

Thanks again!