Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
red8888 opened this issue Jan 21, 2021 · 3 comments
Open

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

red8888 opened this issue Jan 21, 2021 · 3 comments
Labels
question Further information is requested

Comments

@red8888
Copy link

red8888 commented Jan 21, 2021

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?

@red8888 red8888 added the question Further information is requested label Jan 21, 2021
@yahavi
Copy link
Member

yahavi commented Jan 21, 2021

@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
Copy link
Author

red8888 commented Jan 22, 2021

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
Copy link
Member

yahavi commented Jan 23, 2021

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants