Skip to content

Java jsch snippet#5

Open
bullheadandplato wants to merge 22 commits intocrazyantlabs:mainfrom
bullheadandplato:main
Open

Java jsch snippet#5
bullheadandplato wants to merge 22 commits intocrazyantlabs:mainfrom
bullheadandplato:main

Conversation

@bullheadandplato
Copy link
Contributor

No description provided.

Copy link
Member

@motymichaely motymichaely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bullheadandplato Thanks for your contribution. Can you please review the requested changes? Thanks!

// 1) Paste this code into a new file (Sftp.java)
//
// 2) Install dependencies
// ./gradlew build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bullheadandplato - gradlew is not an available utility by default. Please add some instructions on installing gradle in order for it to be available for those that just use this snippet.

// ./gradlew build
//
// 3) Run the script
// ./gradlew run --args="<host> <port> <username> <password>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bullheadandplato Our snippets use SFTPTOGO_URL to parse the required parameters to connect. So I would like the command to run to be something like ./gradlew run and change the main function to parse environment variable like we do in other snippets. For instance: https://github.com/crazyantlabs/sftptogo-examples/blob/main/snippets/nodejs/ssh2/sftp.js.mustache#L89

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@motymichaely Can you please share the details about what can be the value of SFTPTOGO_URL? Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes:

sftp://username:password@host

Port should be 22 by default.


public class Sftp {
public static void main(String[] args) {
var host = args[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bullheadandplato Please review the comment on running the snippet, and make sure we parse an environment variable named SFTPTOGO_URL that defaults to a mustache variable named {{ URI }}. The variable will have the full URI to connect to the server. If Port number is not provided in the URI, default port should be port 22.

@motymichaely
Copy link
Member

@bullheadandplato - Can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants