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

Code for IBMi - external connection #592

Open
cosentino-smeup opened this issue Sep 19, 2024 · 8 comments
Open

Code for IBMi - external connection #592

cosentino-smeup opened this issue Sep 19, 2024 · 8 comments
Labels
question Further information is requested

Comments

@cosentino-smeup
Copy link

I have some questions about IBMi-bob connections:

  • Where are ibmi-bob connections saved?
  • is it possible to create a connection externally to vscode (in a text file, for example) and copy it so that it is recognized by “IBMi-bob”?
@SanjulaGanepola
Copy link
Collaborator

  • Where are ibmi-bob connections saved?

@cosentino-smeup Can you clarify what you mean exactly by "IBMi-bob connections"? Since the bob commands are run on the IBM i, it will be using the connection for the SSH session it was invoked in. This applies to using bob from the command line (PASE) or Project Explorer from VS Code.

  • is it possible to create a connection externally to vscode (in a text file, for example) and copy it so that it is recognized by “IBMi-bob”?

Is your goal to have a local text file with your connection and then invoke a build against that connection from the command line? I believe this would require having to write your own script that would read the connection from the text file and then deploy and build the project on the IBM i. The last two steps can be achieved using @ibm/ibmi-ci.

@edmundreinhardt Are you aware of any other ways to do this easily?

@SanjulaGanepola SanjulaGanepola added the question Further information is requested label Sep 19, 2024
@cosentino-smeup cosentino-smeup changed the title IBMi-bob external connection Code for IBMi - external connection Sep 19, 2024
@cosentino-smeup
Copy link
Author

cosentino-smeup commented Sep 19, 2024

Sorry, my mistake it was "Code for IMB i" connections. (bad copy and paste due to the last issues I opened)

These connections:
ibmi connections

This question is related to this one.

We want our end clients to be able to open PF-SRC members from our product using OpenVSCode using the extension "Code for IBM i". We want this operation to be as much as transparent as possible, because they might not necessary know anything about VS Code and the IBM extension.

Unfortunately, according with @sebjulliand, the solution might not work with OpenVSCode.

With this expectations, I thought I could at least simplify the process by creating a connection with the IMBi during our installation. In fact, we'll provide a container with OpenVSCode and code for IBMi. We have all information we need to create the connection because we use it in our product:

  • connection settings
  • login settings

connection settings
login-settings

I thought that I could write this information in a text file in a specific folder so that the "Code for IBM i" can recognize it.
It's like creating automatically a connection instead of creating it manually.

@worksofliam
Copy link
Member

@cosentino-smeup do a search in the Code for IBM I codebase connectDirect which let's other extensions create a connection.

@sebjulliand
Copy link
Collaborator

@cosentino-smeup It is possible to add connection they way you'd like to.
Code for i connections are stored in the user settings, as JSON. If you open your user settings, you should see something like this:
image

"code-for-ibmi.connections" is an array of JSON objects.
Each object defines a connection with its name, port, username, ...

@cosentino-smeup
Copy link
Author

cosentino-smeup commented Sep 20, 2024

@cosentino-smeup do a search in the Code for IBM I codebase connectDirect which let's other extensions create a connection.

@worksofliam I tried looking for connectDirect but I didn't find anything specific for my case. Can you address me please to find something specific?

I found this.

@sebjulliand
Copy link
Collaborator

sebjulliand commented Sep 20, 2024

This command: https://github.com/codefori/vscode-ibmi/blob/e0e862ea56db64a28161e5c581016e6489645fa9/src/extension.ts#L70

But I don't see how you'd call it unless you write your own extension.

You may want to have a look at this: https://github.com/codefori/vscode-ibmi/blob/e0e862ea56db64a28161e5c581016e6489645fa9/src/sandbox.ts#L10

Code for i can handle a "/connect" URI that allows to connect directly to an IBM i, even saving the connection for further use.
The URI is the following:

vscode://halcyontechltd.code-for-ibmi/connect?server=ADDRESS:PORT&user=MYUSER&pass=BASE64ENCODEDPASS&save=true

This will connect to the ADRESS on port PORT with user MYUSER. If pass is set for the password, it must be base64 encoded. If save is true, the connection will be saved in the connection browser.

This may answer your need. What remains to know is whether or not OpenVSCode can accept these vscode:// URL or not.

@cosentino-smeup
Copy link
Author

cosentino-smeup commented Sep 20, 2024

This may answer your need. What remains to know is whether or not OpenVSCode can accept these vscode:// URL or not.

Exactly, "vscode://" would be the answer if only it worked in OpenVSCode.

I opened a issue to openvscode: here
and I asked a question in stack overflow: here

But I have the feeling that nobody is going to answer :-(

@cosentino-smeup
Copy link
Author

Code for i connections are stored in the user settings, as JSON.

@sebjulliand, unfortunately OpenVSCode persists settings in the browser's indexedDB rather than a settings.json file on the file system.

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

4 participants