neonctl 1.27.0 → 1.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { EndpointType } from '@neondatabase/api-client';
2
2
  import { branchIdFromProps, fillSingleProject } from '../utils/enrichers.js';
3
3
  import { writer } from '../writer.js';
4
4
  import { psql } from '../utils/psql.js';
5
+ const SSL_MODES = ['require', 'verify-ca', 'verify-full', 'omit'];
5
6
  export const command = 'connection-string [branch]';
6
7
  export const aliases = ['cs'];
7
8
  export const describe = 'Get connection string';
@@ -50,9 +51,10 @@ export const builder = (argv) => {
50
51
  default: false,
51
52
  },
52
53
  ssl: {
53
- type: 'boolean',
54
- describe: 'Add sslmode=require to the connection string',
55
- default: true,
54
+ type: 'string',
55
+ choices: SSL_MODES,
56
+ default: 'require',
57
+ describe: 'SSL mode',
56
58
  },
57
59
  })
58
60
  .middleware(fillSingleProject);
@@ -112,8 +114,8 @@ export const handler = async (props) => {
112
114
  connectionString.searchParams.set('pgbouncer', 'true');
113
115
  }
114
116
  }
115
- if (props.ssl) {
116
- connectionString.searchParams.set('sslmode', 'require');
117
+ if (props.ssl !== 'omit') {
118
+ connectionString.searchParams.set('sslmode', props.ssl);
117
119
  }
118
120
  if (props.psql) {
119
121
  const psqlArgs = props['--'];
@@ -177,7 +177,25 @@ describe('connection_string', () => {
177
177
  '--role-name',
178
178
  'test_role',
179
179
  '--ssl',
180
- 'false',
180
+ 'omit',
181
+ ],
182
+ expected: {
183
+ snapshot: true,
184
+ },
185
+ });
186
+ testCliCommand({
187
+ name: 'connection_string with ssl verify full',
188
+ args: [
189
+ 'connection-string',
190
+ 'test_branch',
191
+ '--project-id',
192
+ 'test',
193
+ '--database-name',
194
+ 'test_db',
195
+ '--role-name',
196
+ 'test_role',
197
+ '--ssl',
198
+ 'verify-full',
181
199
  ],
182
200
  expected: {
183
201
  snapshot: true,
package/index.js CHANGED
@@ -52,7 +52,7 @@ builder = builder
52
52
  .option('api-host', {
53
53
  describe: 'The API host',
54
54
  hidden: true,
55
- default: 'https://console.neon.tech/api/v2',
55
+ default: process.env.NEON_API_HOST ?? 'https://console.neon.tech/api/v2',
56
56
  })
57
57
  // Setup config directory
58
58
  .option('config-dir', {
@@ -72,7 +72,7 @@ builder = builder
72
72
  'oauth-host': {
73
73
  description: 'URL to Neon OAuth host',
74
74
  hidden: true,
75
- default: 'https://oauth2.neon.tech',
75
+ default: process.env.NEON_OAUTH_HOST ?? 'https://oauth2.neon.tech',
76
76
  },
77
77
  'client-id': {
78
78
  description: 'OAuth client id',
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git@github.com:neondatabase/neonctl.git"
6
6
  },
7
7
  "type": "module",
8
- "version": "1.27.0",
8
+ "version": "1.27.2",
9
9
  "description": "CLI tool for NeonDB Cloud management",
10
10
  "main": "index.js",
11
11
  "author": "NeonDB",