neonctl 1.27.0 → 1.27.1
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: '
|
|
54
|
-
|
|
55
|
-
default:
|
|
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',
|
|
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
|
-
'
|
|
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,
|