Skip to content

Commit

Permalink
feat: distinguish API URL from web app URL in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
guilgaly committed Sep 23, 2024
1 parent c836eb1 commit e546317
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 29 deletions.
14 changes: 7 additions & 7 deletions js-simulation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions js/cli/src/commands/enterpriseDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import {
sourcesFolderOptionValue,
typescriptOption,
typescriptOptionValueWithDefaults,
urlOption,
urlOptionValue
apiUrlOption,
apiUrlOptionValue,
webAppUrlOption,
webAppUrlOptionValue
} from "./options";
import { findSimulations } from "../simulations";
import { installGatlingJs } from "../dependencies";
Expand All @@ -42,7 +44,8 @@ export default (program: Command): void => {
.addOption(typescriptOption)
.addOption(gatlingHomeOption)
// Base
.addOption(urlOption)
.addOption(apiUrlOption)
.addOption(webAppUrlOption)
.addOption(apiTokenOption)
// Plugin configuration
.addOption(controlPlaneUrlOption)
Expand All @@ -61,7 +64,8 @@ export default (program: Command): void => {
const bundleFile = bundleFileOptionValue(options);
const resultsFolder: string = resultsFolderOptionValue(options);
const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
const url = urlOptionValue(options);
const apiUrl = apiUrlOptionValue(options);
const webAppUrl = webAppUrlOptionValue(options);
const apiToken = apiTokenOptionValue(options);
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
const nonInteractive = nonInteractiveOptionValue(options);
Expand All @@ -77,7 +81,8 @@ export default (program: Command): void => {
bundleFile,
resourcesFolder,
resultsFolder,
url,
apiUrl,
webAppUrl,
apiToken,
controlPlaneUrl,
nonInteractive,
Expand Down
15 changes: 10 additions & 5 deletions js/cli/src/commands/enterpriseStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import {
sourcesFolderOptionValue,
typescriptOption,
typescriptOptionValueWithDefaults,
urlOption,
urlOptionValue,
apiUrlOption,
apiUrlOptionValue,
webAppUrlOption,
webAppUrlOptionValue,
waitForRunEndOption,
waitForRunEndOptionValue
} from "./options";
Expand All @@ -50,7 +52,8 @@ export default (program: Command): void => {
.addOption(typescriptOption)
.addOption(gatlingHomeOption)
// Base
.addOption(urlOption)
.addOption(apiUrlOption)
.addOption(webAppUrlOption)
.addOption(apiTokenOption)
// Plugin configuration
.addOption(controlPlaneUrlOption)
Expand All @@ -74,7 +77,8 @@ export default (program: Command): void => {
const bundleFile = bundleFileOptionValue(options);
const resultsFolder: string = resultsFolderOptionValue(options);
const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
const url = urlOptionValue(options);
const apiUrl = apiUrlOptionValue(options);
const webAppUrl = webAppUrlOptionValue(options);
const apiToken = apiTokenOptionValue(options);
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
const nonInteractive = nonInteractiveOptionValue(options);
Expand All @@ -98,7 +102,8 @@ export default (program: Command): void => {
bundleFile,
resourcesFolder,
resultsFolder,
url,
apiUrl,
webAppUrl,
apiToken,
controlPlaneUrl,
nonInteractive,
Expand Down
9 changes: 7 additions & 2 deletions js/cli/src/commands/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,15 @@ export const parseRunParametersArgument = (args: string[]): Record<string, strin
return parsedParameters;
};

export const urlOption = new Option("--url <value>", "URL of Gatling Enterprise")
export const apiUrlOption = new Option("--apiUrl <value>", "URL of the Gatling Enterprise API")
.default("https://api.gatling.io")
.hideHelp();
export const apiUrlOptionValue = getStringValueMandatory(apiUrlOption);

export const webAppUrlOption = new Option("--webAppUrl <value>", "URL of the Gatling Enterprise web app")
.default("https://cloud.gatling.io")
.hideHelp();
export const urlOptionValue = getStringValueMandatory(urlOption);
export const webAppUrlOptionValue = getStringValueMandatory(webAppUrlOption);

export const apiTokenOption = new Option(
"--api-token <value>",
Expand Down
6 changes: 4 additions & 2 deletions js/cli/src/enterprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export interface EnterprisePluginOptions extends RunJavaProcessOptions {
resourcesFolder: string;
resultsFolder: string;
// Base
url: string;
apiUrl: string;
webAppUrl: string;
apiToken?: string;
// Plugin configuration
controlPlaneUrl?: string;
Expand All @@ -135,7 +136,8 @@ const javaArgsFromPluginOptions = (options: EnterprisePluginOptions) => {
const javaArgs: string[] = [];

// Base
javaArgs.push(`-Dgatling.enterprise.url=${options.url}`);
javaArgs.push(`-Dgatling.enterprise.apiUrl=${options.apiUrl}`);
javaArgs.push(`-Dgatling.enterprise.webAppUrl=${options.webAppUrl}`);
if (options.apiToken !== undefined) {
javaArgs.push(`-Dgatling.enterprise.apiToken=${options.apiToken}`);
}
Expand Down
2 changes: 1 addition & 1 deletion jvm/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ val coursierVersion = "2.1.12"
val gatlingVersion = "3.12.0"

// bit weird cause this is not a dependency of this project
val gatlingEnterpriseComponentPluginVersion = "1.9.6"
val gatlingEnterpriseComponentPluginVersion = "1.9.8"

lazy val root = (project in file("."))
.aggregate(adapter, java2ts)
Expand Down
14 changes: 7 additions & 7 deletions ts-simulation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e546317

Please sign in to comment.