Skip to content

Commit

Permalink
Added dynamic cluster support for ext preview based on fdk logged in … (
Browse files Browse the repository at this point in the history
#365)

* Added dynamic cluster support for ext preview based on fdk logged in cluster

* Updated remoteInstall script

---------

Co-authored-by: vivek-gofynd <[email protected]>
  • Loading branch information
bhargavprajapatiFynd and vivek-gofynd authored Oct 30, 2024
1 parent 2793f85 commit ede64f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions scripts/remoteInstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ npm run build
PACKAGE_FILE=$(npm pack)
echo "Package $PACKAGE_FILE created!"

# Uninstall the fdk-cli if it is already installed globally
npm uninstall -g @gofynd/fdk-cli || true

# Install the package globally
npm install -g "$PACKAGE_FILE"
echo "fdk-cli has been installed globally!"
Expand Down
5 changes: 5 additions & 0 deletions src/lib/Env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export default class Env {
finalDomain = domain.replace('https://', '');
}

// remove http:// from domain if present
if (domain.includes('http://')) {
finalDomain = domain.replace('http://', '');
}

// validate domain
if (!isValidDomain(finalDomain)) {
throw new CommandError(
Expand Down
8 changes: 7 additions & 1 deletion src/lib/ExtensionPreviewURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import yaml from 'js-yaml';
import Tunnel from './Tunnel';
import chalk from 'chalk';
import ExtensionContext from './ExtensionContext';
import Env from './Env';
import configStore, { CONFIG_KEYS } from './Config';
let attempts: number = 0;
const maxAttempts: number = 5;
Expand All @@ -40,6 +41,10 @@ export default class ExtensionPreviewURL {
publicTunnelURL: string;
options: Object;
firstTunnelConnection: boolean = true;
fp_api_domain: string = urljoin(
'https://',
Env.getEnvValue()
);

// command handler for "extension preview-url"
public static async previewUrlExtensionHandler(options) {
Expand Down Expand Up @@ -239,7 +244,8 @@ export default class ExtensionPreviewURL {
BACKEND_PORT: backend_port.toString(),
EXTENSION_API_KEY: extension.options.apiKey,
EXTENSION_API_SECRET: extension.options.apiSecret,
EXTENSION_BASE_URL: extension.publicTunnelURL
EXTENSION_BASE_URL: extension.publicTunnelURL,
FP_API_DOMAIN: extension.fp_api_domain
}
}).catch((error) => {
Debug(error);
Expand Down

0 comments on commit ede64f9

Please sign in to comment.