Skip to content

Commit cbd5960

Browse files
committed
feat: Add trust store configuration to the CLI
Being able to configure a custom trust store is useful with private packages, as the control plane may use a certificate from an internal CA.
1 parent 7c26c01 commit cbd5960

File tree

6 files changed

+58
-18
lines changed

6 files changed

+58
-18
lines changed

js-simulation/package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/cli/src/commands/enterpriseDeploy.ts

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ import {
2323
resultsFolderOptionValue,
2424
sourcesFolderOption,
2525
sourcesFolderOptionValue,
26+
trustStoreOption,
27+
trustStoreOptionValue,
28+
trustStorePasswordOption,
29+
trustStorePasswordOptionValue,
2630
typescriptOption,
2731
typescriptOptionValueWithDefaults,
2832
apiUrlOption,
@@ -52,6 +56,8 @@ export default (program: Command): void => {
5256
.addOption(apiTokenOption)
5357
// Plugin configuration
5458
.addOption(controlPlaneUrlOption)
59+
.addOption(trustStoreOption)
60+
.addOption(trustStorePasswordOption)
5561
.addOption(nonInteractiveOption)
5662
// Descriptor file
5763
.addOption(packageDescriptorFilenameOption)
@@ -72,6 +78,8 @@ export default (program: Command): void => {
7278
const webAppUrl = webAppUrlOptionValue(options);
7379
const apiToken = apiTokenOptionValue(options);
7480
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
81+
const trustStore = trustStoreOptionValue(options);
82+
const trustStorePassword = trustStorePasswordOptionValue(options);
7583
const nonInteractive = nonInteractiveOptionValue(options);
7684
const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
7785
const packageFile = packageFileOptionValue(options);
@@ -89,6 +97,8 @@ export default (program: Command): void => {
8997
webAppUrl,
9098
apiToken,
9199
controlPlaneUrl,
100+
trustStore,
101+
trustStorePassword,
92102
nonInteractive,
93103
packageDescriptorFilename,
94104
packageFile

js/cli/src/commands/enterpriseStart.ts

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import {
2929
runTitleOptionValue,
3030
sourcesFolderOption,
3131
sourcesFolderOptionValue,
32+
trustStoreOption,
33+
trustStoreOptionValue,
34+
trustStorePasswordOption,
35+
trustStorePasswordOptionValue,
3236
typescriptOption,
3337
typescriptOptionValueWithDefaults,
3438
apiUrlOption,
@@ -60,6 +64,8 @@ export default (program: Command): void => {
6064
.addOption(apiTokenOption)
6165
// Plugin configuration
6266
.addOption(controlPlaneUrlOption)
67+
.addOption(trustStoreOption)
68+
.addOption(trustStorePasswordOption)
6369
.addOption(nonInteractiveOption)
6470
// Descriptor file
6571
.addOption(packageDescriptorFilenameOption)
@@ -85,6 +91,8 @@ export default (program: Command): void => {
8591
const webAppUrl = webAppUrlOptionValue(options);
8692
const apiToken = apiTokenOptionValue(options);
8793
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
94+
const trustStore = trustStoreOptionValue(options);
95+
const trustStorePassword = trustStorePasswordOptionValue(options);
8896
const nonInteractive = nonInteractiveOptionValue(options);
8997
const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
9098
const packageFile = packageFileOptionValue(options);
@@ -110,6 +118,8 @@ export default (program: Command): void => {
110118
webAppUrl,
111119
apiToken,
112120
controlPlaneUrl,
121+
trustStore,
122+
trustStorePassword,
113123
nonInteractive,
114124
packageDescriptorFilename,
115125
packageFile,

js/cli/src/commands/options.ts

+12
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,18 @@ export const controlPlaneUrlOption = new Option(
282282
);
283283
export const controlPlaneUrlOptionValue = getStringValueOptional(controlPlaneUrlOption);
284284

285+
export const trustStoreOption = new Option(
286+
"--trust-store <value>",
287+
`Path to a trust store (in PKCS#12 or JKS format) used when calling remote APIs over HTTPS. Useful with the ${controlPlaneUrlOption.long} option, if your control plane uses a certificate signed by an internal CA.`
288+
);
289+
export const trustStoreOptionValue = getStringValueOptional(trustStoreOption);
290+
291+
export const trustStorePasswordOption = new Option(
292+
"--trust-store-password <value>",
293+
`Use with the ${trustStoreOption.long} option, if your trust store is protected by a password.`
294+
);
295+
export const trustStorePasswordOptionValue = getStringValueOptional(trustStorePasswordOption);
296+
285297
// Descriptor file
286298

287299
export const packageDescriptorFilenameOption = new Option(

js/cli/src/enterprise.ts

+8
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export interface EnterprisePluginOptions extends RunJavaProcessOptions {
134134
apiToken?: string;
135135
// Plugin configuration
136136
controlPlaneUrl?: string;
137+
trustStore?: string;
138+
trustStorePassword?: string;
137139
nonInteractive: boolean;
138140
}
139141

@@ -151,6 +153,12 @@ const javaArgsFromPluginOptions = (options: EnterprisePluginOptions) => {
151153
if (options.controlPlaneUrl !== undefined) {
152154
javaArgs.push(`-Dgatling.enterprise.controlPlaneUrl=${options.controlPlaneUrl}`);
153155
}
156+
if (options.trustStore !== undefined) {
157+
javaArgs.push(`-Djavax.net.ssl.trustStore=${options.trustStore}`);
158+
}
159+
if (options.trustStore !== undefined && options.trustStorePassword !== undefined) {
160+
javaArgs.push(`-Djavax.net.ssl.trustStorePassword=${options.trustStorePassword}`);
161+
}
154162
javaArgs.push("-Dgatling.enterprise.buildTool=js-cli");
155163
javaArgs.push(`-Dgatling.enterprise.pluginVersion=${versions.gatling.jsAdapter}`);
156164

ts-simulation/package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)