Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@useoptic/cli-config

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@useoptic/cli-config - npm Package Compare versions

Comparing version 8.1.1 to 8.2.0

1

build/index.d.ts

@@ -17,2 +17,3 @@ import { parseRule, parseIgnore, IIgnoreRunnable } from './helpers/ignore-parser';

proxy?: string;
targetUrl?: string;
}

@@ -19,0 +20,0 @@ export interface IApiCliConfig {

52

build/index.js

@@ -50,27 +50,33 @@ "use strict";

async function TaskToStartConfig(task) {
const parsedBaseUrl = url_1.default.parse(task.baseUrl);
const randomPort = await get_port_1.default({ port: get_port_1.default.makeRange(3300, 3900) });
const serviceProtocol = parsedBaseUrl.protocol || 'http:';
const proxyPort = parsedBaseUrl.port || (serviceProtocol === 'http:' ? '80' : '443');
const parsedProxyBaseUrl = task.proxy && url_1.default.parse(task.proxy);
const baseUrl = url_1.default.parse(task.baseUrl);
const targetUrl = (task.targetUrl && url_1.default.parse(task.targetUrl)) ||
(task.proxy && url_1.default.parse(task.proxy)); // TODO: add deprecation warning
const serviceProtocol = (targetUrl && targetUrl.protocol) || baseUrl.protocol || 'http:';
const serviceConfig = {
host: (targetUrl && targetUrl.hostname) || baseUrl.hostname || 'localhost',
protocol: serviceProtocol,
port: targetUrl && targetUrl.port
? parseInt(targetUrl.port) // use target port if available
: targetUrl
? serviceProtocol === 'http:' // assume standard ports for targets without explicit ports
? 80
: 443
: await get_port_1.default({ port: get_port_1.default.makeRange(3300, 3900) }),
basePath: (targetUrl && targetUrl.path) || baseUrl.path || '/',
};
const proxyProtocol = baseUrl.protocol || 'http:';
const proxyConfig = {
host: baseUrl.hostname || 'localhost',
protocol: proxyProtocol,
port: baseUrl.port
? parseInt(baseUrl.port) // use base url port if explicitly set
: proxyProtocol === 'http:' // assume standard port for base url without explicit port
? 80
: 443,
basePath: serviceConfig.basePath,
};
return {
command: task.command,
serviceConfig: {
port: task.proxy ? parseInt(proxyPort, 10) : randomPort,
host: parsedBaseUrl.hostname || 'localhost',
protocol: serviceProtocol,
basePath: parsedBaseUrl.path || '/',
},
proxyConfig: {
port: parseInt(parsedProxyBaseUrl
? parsedProxyBaseUrl.port ||
(serviceProtocol === 'http:' ? '80' : '443')
: proxyPort, 10),
host: (parsedProxyBaseUrl
? parsedProxyBaseUrl.hostname
: parsedBaseUrl.hostname) || 'localhost',
protocol: (parsedProxyBaseUrl ? parsedProxyBaseUrl.protocol : serviceProtocol) ||
'http:',
basePath: parsedBaseUrl.path || '/',
},
serviceConfig,
proxyConfig,
};

@@ -77,0 +83,0 @@ }

{
"name": "@useoptic/cli-config",
"version": "8.1.1",
"version": "8.2.0",
"scripts": {

@@ -5,0 +5,0 @@ "ws:test": "echo config",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc