Skip to content

Commit

Permalink
created RunData interface for privateKey access
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark-Kernel authored and rajdip-b committed Jul 29, 2024
1 parent 1fdce89 commit 508da8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/cli/src/commands/run.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
import { Logger } from '@/util/logger'
import type {
ClientRegisteredResponse,
Configuration
Configuration,
RunData
} from '@/types/command/run.types'

import { decrypt } from '@/util/decrypt'
Expand Down Expand Up @@ -54,7 +55,7 @@ export default class RunCommand extends BaseCommand {
}

private async fetchConfigurations(): Promise<
ProjectRootConfig & { privateKey: string }
ProjectRootConfig & RunData
> {
const { environment, project, workspace, quitOnDecryptionFailure } = await fetchProjectRootConfig()
const privateKeyConfig = await fetchPrivateKeyConfig()
Expand All @@ -81,14 +82,13 @@ export default class RunCommand extends BaseCommand {
return 'ws'
}

private async connectToSocket(data: ProjectRootConfig) {
private async connectToSocket(data: ProjectRootConfig & RunData) {
Logger.info('Connecting to socket...')
const host = this.baseUrl.substring(this.baseUrl.lastIndexOf('/') + 1)
const websocketUrl = `${this.getWebsocketType(this.baseUrl)}://${host}/change-notifier`
const privateKey = (data as any).privateKey;
const privateKey = data.privateKey
const quitOnDecryptionFailure = data.quitOnDecryptionFailure


const ioClient = io(websocketUrl, {
autoConnect: false,
extraHeaders: {
Expand Down
6 changes: 6 additions & 0 deletions apps/cli/src/types/command/run.types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ProjectRootConfig } from "../index.types"

export interface Configuration {
name: string
value: string
Expand All @@ -9,3 +11,7 @@ export interface ClientRegisteredResponse {
projectId: string
environmentId: string
}

export interface RunData extends ProjectRootConfig{
privateKey: string
}

0 comments on commit 508da8c

Please sign in to comment.