Skip to content

Commit f607509

Browse files
feat: postgres connection port restrictions
1 parent 971b3d4 commit f607509

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.changeset/eighty-coins-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/service-core': patch
3+
---
4+
5+
Improved Postgres connection port restrictions. Connections are now supported on ports >= 1024.

packages/service-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": "tsc -b",
1414
"build:tests": "tsc -b test/tsconfig.json",
1515
"test": "vitest --no-threads",
16-
"clean": "rm -rf ./lib && tsc -b --clean"
16+
"clean": "rm -rf ./dist && tsc -b --clean"
1717
},
1818
"dependencies": {
1919
"@js-sdsl/ordered-set": "^4.4.2",

packages/types/src/config/normalize.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { PostgresConnection } from './PowerSyncConfig.js';
21
import * as urijs from 'uri-js';
2+
import { PostgresConnection } from './PowerSyncConfig.js';
33

44
/**
55
* Validate and normalize connection options.
@@ -97,11 +97,10 @@ export function validatePort(port: string | number): number {
9797
if (typeof port == 'string') {
9898
port = parseInt(port);
9999
}
100-
if (port >= 1024 && port <= 49151) {
101-
return port;
102-
} else {
100+
if (port < 1024) {
103101
throw new Error(`Port ${port} not supported`);
104102
}
103+
return port;
105104
}
106105

107106
/**

0 commit comments

Comments
 (0)