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

Allow to set FTP timeout through options. #23

Merged
merged 2 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function deploy(args: IFtpDeployArgumentsWithDefaults, logger: ILog

createLocalState(localFiles, logger, args);

const client = new ftp.Client();
const client = new ftp.Client(args.timeout);

global.reconnect = async function () {
timings.start("connecting");
Expand Down
1 change: 1 addition & 0 deletions src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ describe("getLocalFiles", () => {
exclude: [],
"log-level": "standard",
security: "loose",
timeout: 30000,
});

const mainYamlDiff = localDirDiffs.data.find(diff => diff.name === "workflows/main.yml")! as IFile;
Expand Down
10 changes: 9 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ export interface IFtpDeployArguments {
* When using protocol "ftps" or "ftps-legacy" should the cert name need to match exactly?
* Set this to "strict" to ensure your data is being encrypted
*
* Defautls to loose because of the sheer volume of shared hosts that give ftp domains a cert without a matching common name
* Defaults to loose because of the sheer volume of shared hosts that give ftp domains a cert without a matching common name
* @default "loose"
*/
security?: "strict" | "loose";

/**
* Timeout in milliseconds for FTP operations as handled by underlying basic-ftp connection library.
*
* Defaults to 30000 milliseconds (30s).
*/
timeout?: 30000;
}

export interface IFtpDeployArgumentsWithDefaults {
Expand All @@ -77,6 +84,7 @@ export interface IFtpDeployArgumentsWithDefaults {
exclude: string[];
"log-level": "minimal" | "standard" | "verbose";
security: "strict" | "loose";
timeout: number;
}

export interface IFile {
Expand Down
1 change: 1 addition & 0 deletions src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export function getDefaultSettings(withoutDefaults: IFtpDeployArguments): IFtpDe
"exclude": withoutDefaults.exclude ?? excludeDefaults,
"log-level": withoutDefaults["log-level"] ?? "standard",
"security": withoutDefaults.security ?? "loose",
"timeout": withoutDefaults.timeout ?? 30000
SamKirkland marked this conversation as resolved.
Show resolved Hide resolved
};
}

Expand Down