Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions src/cli/dashboard/_shared/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ export abstract class DashboardCommand extends Command {
};

private _client: DashboardClient | undefined;
private _config: CliConfig | undefined;
private _cliConfig: CliConfig | undefined;

protected get config_(): CliConfig {
if (!this._config) {
protected get cliConfig(): CliConfig {
if (!this._cliConfig) {
const config = loadConfig();
if (!config) {
this.error('Not logged in. Run `cascade login` first.');
}
this._config = config;
this._cliConfig = config;
}
return this._config;
return this._cliConfig;
}

protected get client(): DashboardClient {
if (!this._client) {
const config = this.config_;
const config = this.cliConfig;
// Allow --server and --org flags to override
const flags = this.parseBaseFlags();
if (flags?.server) {
Expand Down Expand Up @@ -192,7 +192,7 @@ export abstract class DashboardCommand extends Command {
process.stderr.write(`${err.stack}\n`);
}

const serverUrl = this._config?.serverUrl;
const serverUrl = this._cliConfig?.serverUrl;
const actionable = mapError(err, serverUrl);
const message = formatActionableError(actionable);

Expand Down
2 changes: 1 addition & 1 deletion src/cli/dashboard/webhooks/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class WebhooksCreate extends DashboardCommand {
const { args, flags } = await this.parse(WebhooksCreate);

try {
const callbackBaseUrl = flags['callback-url'] || this.config_.serverUrl;
const callbackBaseUrl = flags['callback-url'] || this.cliConfig.serverUrl;

const oneTimeTokens: Record<string, string> = {};
if (flags['github-token']) oneTimeTokens.github = flags['github-token'];
Expand Down
2 changes: 1 addition & 1 deletion src/cli/dashboard/webhooks/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class WebhooksDelete extends DashboardCommand {
const { args, flags } = await this.parse(WebhooksDelete);

try {
const callbackBaseUrl = flags['callback-url'] || this.config_.serverUrl;
const callbackBaseUrl = flags['callback-url'] || this.cliConfig.serverUrl;

const oneTimeTokens: Record<string, string> = {};
if (flags['github-token']) oneTimeTokens.github = flags['github-token'];
Expand Down
2 changes: 1 addition & 1 deletion src/cli/dashboard/webhooks/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class WebhooksList extends DashboardCommand {

const result = await this.client.webhooks.list.query({
projectId: args.projectId,
callbackBaseUrl: this.config_.serverUrl || undefined,
callbackBaseUrl: this.cliConfig.serverUrl || undefined,
oneTimeTokens: Object.keys(oneTimeTokens).length > 0 ? oneTimeTokens : undefined,
});

Expand Down
Loading