Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 17
Added proxy support#2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Added proxy support #2252
Changes from all commits
aa8e55d4fa85214abb2b701beab519755ef8d3ef95b8d6335297eca4e912170f67e67828727c026f49a2bf0540ea626f76d787942345ec3f8e83722225f41a9bca9e8a67264da048374File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -22,8 +22,8 @@ | ||
| "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"" | ||
| }, | ||
| "dependencies": { | ||
| "@contentstack/cli-command": "~1.7.1", | ||
| "@contentstack/cli-utilities": "~1.16.1", | ||
| "@contentstack/cli-command": "~1.7.2", | ||
| "@contentstack/cli-utilities": "~1.17.0", | ||
sunil-lakshman marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "@oclif/core": "^4.3.0", | ||
| "@oclif/plugin-help": "^6.2.28", | ||
| "otplib": "^12.0.1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -17,8 +17,8 @@ | ||
| }, | ||
| "dependencies": { | ||
| "@contentstack/cli-cm-seed": "~1.14.1", | ||
| "@contentstack/cli-command": "~1.7.1", | ||
| "@contentstack/cli-utilities": "~1.16.1", | ||
| "@contentstack/cli-command": "~1.7.2", | ||
| "@contentstack/cli-utilities": "~1.17.0", | ||
sunil-lakshman marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "@oclif/core": "^4.3.0", | ||
| "@oclif/plugin-help": "^6.2.28", | ||
| "inquirer": "8.2.7", | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| { | ||
| "name": "@contentstack/cli-cm-branches", | ||
| "description": "Contentstack CLI plugin to do branches operations", | ||
| "version": "1.6.2", | ||
| "version": "1.6.3", | ||
| "author": "Contentstack", | ||
| "bugs": "https://github.com/contentstack/cli/issues", | ||
| "dependencies": { | ||
| "@contentstack/cli-command": "~1.7.1", | ||
| "@contentstack/cli-command": "~1.7.2", | ||
| "@oclif/core": "^4.3.0", | ||
| "@oclif/plugin-help": "^6.2.28", | ||
| "@contentstack/cli-utilities": "~1.16.1", | ||
| "@contentstack/cli-utilities": "~1.17.0", | ||
sunil-lakshman marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "chalk": "^4.1.2", | ||
| "just-diff": "^6.0.2", | ||
| "lodash": "^4.17.21" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,9 +5,9 @@ | ||
| "author": "Contentstack", | ||
| "bugs": "https://github.com/contentstack/cli/issues", | ||
| "dependencies": { | ||
| "@contentstack/cli-command": "~1.7.1", | ||
| "@contentstack/cli-command": "~1.7.2", | ||
| "@contentstack/cli-config": "~1.17.0", | ||
| "@contentstack/cli-utilities": "~1.16.1", | ||
| "@contentstack/cli-utilities": "~1.17.0", | ||
sunil-lakshman marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "@oclif/core": "^4.3.0", | ||
| "@oclif/plugin-help": "^6.2.28", | ||
| "chalk": "^4.1.2", | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "name": "@contentstack/cli-command", | ||
| "description": "Contentstack CLI plugin for configuration", | ||
| "version": "1.7.1", | ||
| "version": "1.7.2", | ||
| "author": "Contentstack", | ||
| "main": "lib/index.js", | ||
| "types": "lib/index.d.ts", | ||
| @@ -19,7 +19,7 @@ | ||
| "test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.ts\"" | ||
| }, | ||
| "dependencies": { | ||
| "@contentstack/cli-utilities": "~1.16.1", | ||
| "@contentstack/cli-utilities": "~1.17.0", | ||
sunil-lakshman marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "contentstack": "^3.25.3", | ||
| "@oclif/core": "^4.3.0", | ||
| "@oclif/plugin-help": "^6.2.28" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { cliux, configHandler, TableHeader, log, handleAndLogError } from '@contentstack/cli-utilities'; | ||
| import { BaseCommand } from '../../../base-command'; | ||
| export default class ProxyGetCommand extends BaseCommand<typeof ProxyGetCommand> { | ||
| static description = 'Get proxy configuration for CLI'; | ||
| static examples = ['csdx config:get:proxy']; | ||
| async run() { | ||
| try { | ||
| log.debug('Starting proxy configuration retrieval', this.contextDetails); | ||
| const globalProxyConfig = configHandler.get('proxy'); | ||
| if (globalProxyConfig) { | ||
| log.debug('Proxy configuration found in global config', this.contextDetails); | ||
| let usernameValue = 'Not set'; | ||
| if (globalProxyConfig.auth?.username) { | ||
| usernameValue = globalProxyConfig.auth.username; | ||
| } | ||
| const proxyConfigList = [ | ||
| { | ||
| Setting: 'Host', | ||
| Value: globalProxyConfig.host || 'Not set', | ||
| }, | ||
| { | ||
| Setting: 'Port', | ||
| Value: globalProxyConfig.port ? String(globalProxyConfig.port) : 'Not set', | ||
| }, | ||
| { | ||
| Setting: 'Protocol', | ||
| Value: globalProxyConfig.protocol || 'Not set', | ||
| }, | ||
| { | ||
| Setting: 'Username', | ||
| Value: usernameValue, | ||
| }, | ||
| { | ||
| Setting: 'Password', | ||
| Value: globalProxyConfig.auth?.password ? '***' : 'Not set', | ||
| }, | ||
| ]; | ||
| const headers: TableHeader[] = [{ value: 'Setting' }, { value: 'Value' }]; | ||
| cliux.table(headers, proxyConfigList); | ||
| log.info('Proxy configuration displayed successfully', this.contextDetails); | ||
| } else { | ||
| log.debug('No proxy configuration found in global config', this.contextDetails); | ||
| } | ||
| } catch (error) { | ||
| handleAndLogError(error, { ...this.contextDetails, module: 'config-get-proxy' }); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { configHandler, log, handleAndLogError } from '@contentstack/cli-utilities'; | ||
| import { BaseCommand } from '../../../base-command'; | ||
| export default class ProxyRemoveCommand extends BaseCommand<typeof ProxyRemoveCommand> { | ||
| static description = 'Remove proxy configuration from global config'; | ||
| static examples = ['csdx config:remove:proxy']; | ||
| async run() { | ||
| try { | ||
| log.debug('Starting proxy configuration removal', this.contextDetails); | ||
| const currentProxy = configHandler.get('proxy'); | ||
| if (!currentProxy) { | ||
| log.debug('No proxy configuration found in global config', this.contextDetails); | ||
| return; | ||
| } | ||
| log.debug('Removing proxy configuration from global config', this.contextDetails); | ||
| configHandler.delete('proxy'); | ||
| log.success('Proxy configuration removed from global config successfully', this.contextDetails); | ||
| } catch (error) { | ||
| handleAndLogError(error, { ...this.contextDetails, module: 'config-remove-proxy' }); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.