Skip to content

Commit f46e7c2

Browse files
authored
feat: Add maintenanceKey and bump dependencies (#79)
* feat: Add maintenanceKey and bump dependencies * lint * adjust liveQuery classes * use latest server version
1 parent a33295c commit f46e7c2

File tree

10 files changed

+821
-71
lines changed

10 files changed

+821
-71
lines changed

.env

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
PARSE_SERVER_APPLICATION_ID=applicationId
2+
PARSE_SERVER_MAINTENANCE_KEY=maintenanceKey
23
PARSE_SERVER_PRIMARY_KEY=primaryKey
34
PARSE_SERVER_WEBHOOK_KEY=webhookKey
5+
POSTGRES_USER=postgres
46
POSTGRES_PASSWORD=postgres
57
PG_PARSE_USER=parse
68
PG_PARSE_PASSWORD=parse

Package.resolved

+45-18
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/swift-server/async-http-client.git",
77
"state" : {
8-
"revision" : "0ae99db85b2b9d1e79b362bd31fd1ffe492f7c47",
9-
"version" : "1.21.2"
8+
"revision" : "333f51104b75d1a5b94cb3b99e4c58a3b442c9f7",
9+
"version" : "1.25.2"
1010
}
1111
},
1212
{
1313
"identity" : "async-kit",
1414
"kind" : "remoteSourceControl",
1515
"location" : "https://github.com/vapor/async-kit.git",
1616
"state" : {
17-
"revision" : "e048c8ee94967e8d8a1c2ec0e1156d6f7fa34d31",
18-
"version" : "1.20.0"
17+
"revision" : "7ece208cd401687641c88367a00e3ea2b04311f1",
18+
"version" : "1.19.0"
1919
}
2020
},
2121
{
@@ -41,8 +41,8 @@
4141
"kind" : "remoteSourceControl",
4242
"location" : "https://github.com/netreconlab/Parse-Swift.git",
4343
"state" : {
44-
"revision" : "b56de0a0770fb3ac267d3d8d1cc3924fbfbf3d16",
45-
"version" : "5.11.2"
44+
"revision" : "7a06604443662204d1d9a38a7307a8c42c8d1d6c",
45+
"version" : "5.12.0"
4646
}
4747
},
4848
{
@@ -90,6 +90,24 @@
9090
"version" : "3.5.2"
9191
}
9292
},
93+
{
94+
"identity" : "swift-distributed-tracing",
95+
"kind" : "remoteSourceControl",
96+
"location" : "https://github.com/apple/swift-distributed-tracing.git",
97+
"state" : {
98+
"revision" : "a64a0abc2530f767af15dd88dda7f64d5f1ff9de",
99+
"version" : "1.2.0"
100+
}
101+
},
102+
{
103+
"identity" : "swift-http-structured-headers",
104+
"kind" : "remoteSourceControl",
105+
"location" : "https://github.com/apple/swift-http-structured-headers.git",
106+
"state" : {
107+
"revision" : "d01361d32e14ae9b70ea5bd308a3794a198a2706",
108+
"version" : "1.2.0"
109+
}
110+
},
93111
{
94112
"identity" : "swift-http-types",
95113
"kind" : "remoteSourceControl",
@@ -122,35 +140,35 @@
122140
"kind" : "remoteSourceControl",
123141
"location" : "https://github.com/apple/swift-nio.git",
124142
"state" : {
125-
"revision" : "e4abde8be0e49dc7d66e6eed651254accdcd9533",
126-
"version" : "2.69.0"
143+
"revision" : "c51907a839e63ebf0ba2076bba73dd96436bd1b9",
144+
"version" : "2.81.0"
127145
}
128146
},
129147
{
130148
"identity" : "swift-nio-extras",
131149
"kind" : "remoteSourceControl",
132150
"location" : "https://github.com/apple/swift-nio-extras.git",
133151
"state" : {
134-
"revision" : "05c36b57453d23ea63785d58a7dbc7b70ba1745e",
135-
"version" : "1.23.0"
152+
"revision" : "00f3f72d2f9942d0e2dc96057ab50a37ced150d4",
153+
"version" : "1.25.0"
136154
}
137155
},
138156
{
139157
"identity" : "swift-nio-http2",
140158
"kind" : "remoteSourceControl",
141159
"location" : "https://github.com/apple/swift-nio-http2.git",
142160
"state" : {
143-
"revision" : "b5f7062b60e4add1e8c343ba4eb8da2e324b3a94",
144-
"version" : "1.34.0"
161+
"revision" : "a0224f3d20438635dd59c9fcc593520d80d131d0",
162+
"version" : "1.33.0"
145163
}
146164
},
147165
{
148166
"identity" : "swift-nio-ssl",
149167
"kind" : "remoteSourceControl",
150168
"location" : "https://github.com/apple/swift-nio-ssl.git",
151169
"state" : {
152-
"revision" : "2b09805797f21c380f7dc9bedaab3157c5508efb",
153-
"version" : "2.27.0"
170+
"revision" : "0cc3528ff48129d64ab9cab0b1cd621634edfc6b",
171+
"version" : "2.29.3"
154172
}
155173
},
156174
{
@@ -171,22 +189,31 @@
171189
"version" : "1.0.2"
172190
}
173191
},
192+
{
193+
"identity" : "swift-service-context",
194+
"kind" : "remoteSourceControl",
195+
"location" : "https://github.com/apple/swift-service-context.git",
196+
"state" : {
197+
"revision" : "8946c930cae601452149e45d31d8ddfac973c3c7",
198+
"version" : "1.2.0"
199+
}
200+
},
174201
{
175202
"identity" : "swift-system",
176203
"kind" : "remoteSourceControl",
177204
"location" : "https://github.com/apple/swift-system.git",
178205
"state" : {
179-
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
180-
"version" : "1.3.2"
206+
"revision" : "a34201439c74b53f0fd71ef11741af7e7caf01e1",
207+
"version" : "1.4.2"
181208
}
182209
},
183210
{
184211
"identity" : "vapor",
185212
"kind" : "remoteSourceControl",
186213
"location" : "https://github.com/vapor/vapor.git",
187214
"state" : {
188-
"revision" : "a823735db57b46100b0c61cdfc5a08525b1e7cad",
189-
"version" : "4.102.1"
215+
"revision" : "a425e32f9b9d19c0ecab952cb4484c1c15e2536f",
216+
"version" : "4.113.2"
190217
}
191218
},
192219
{

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ let package = Package(
2121
dependencies: [
2222
.package(
2323
url: "https://github.com/vapor/vapor.git",
24-
.upToNextMajor(from: "4.102.1")
24+
.upToNextMajor(from: "4.113.2")
2525
),
2626
.package(
2727
url: "https://github.com/netreconlab/Parse-Swift.git",
28-
.upToNextMajor(from: "5.11.2")
28+
.upToNextMajor(from: "5.12.0")
2929
)
3030
],
3131
targets: [

Sources/ParseServerSwift/Parse.swift

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func initializeServer(
7171
try await ParseSwift.initialize(
7272
applicationId: configuration.applicationId,
7373
primaryKey: configuration.primaryKey,
74+
maintenanceKey: configuration.maintenanceKey,
7475
serverURL: parseServerURL,
7576
// POST all queries instead of using GET.
7677
usingPostForQuery: true,

Sources/ParseServerSwift/ParseServerConfiguration.swift

+27-15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public struct ParseServerConfiguration {
1616
/// The application id for your Node.js Parse Server application.
1717
public internal(set) var applicationId: String
1818

19+
/// The maintenance key for your Node.js Parse Server application.
20+
public internal(set) var maintenanceKey: String?
21+
1922
/// The primary key for your Node.js Parse Server application.
2023
/// - note: This has been renamed from `masterKey` to reflect
2124
/// [inclusive language](https://github.com/dialpad/inclusive-language#motivation).
@@ -43,17 +46,22 @@ public struct ParseServerConfiguration {
4346
- parameter tlsConfiguration: Manages configuration of TLS for SwiftNIO programs.
4447
- throws: An error of `ParseError` type.
4548
- important: This initializer looks for environment variables that begin
46-
with **PARSE_SERVER_SWIFT** such as **PARSE_SERVER_SWIFT_APPLICATION_ID**
47-
and **PARSE_SERVER_SWIFT_PRIMARY_KEY**.
49+
with **PARSE_SERVER_SWIFT** such as **PARSE_SERVER_SWIFT_APPLICATION_ID**,
50+
**PARSE_SERVER_SWIFT_MAINTENANCE_KEY**, and **PARSE_SERVER_SWIFT_PRIMARY_KEY**.
4851
*/
49-
public init(app: Application,
50-
tlsConfiguration: TLSConfiguration? = nil) throws {
52+
public init(
53+
app: Application,
54+
tlsConfiguration: TLSConfiguration? = nil
55+
) throws {
5156
guard let applicationId = Environment.process.PARSE_SERVER_SWIFT_APPLICATION_ID,
5257
let primaryKey = Environment.process.PARSE_SERVER_SWIFT_PRIMARY_KEY else {
53-
throw ParseError(code: .otherCause,
54-
message: "Missing environment variables for applicationId or primaryKey")
58+
throw ParseError(
59+
code: .otherCause,
60+
message: "Missing environment variables for applicationId or primaryKey"
61+
)
5562
}
5663
self.applicationId = applicationId
64+
self.maintenanceKey = Environment.process.PARSE_SERVER_SWIFT_MAINTENANCE_KEY
5765
self.primaryKey = primaryKey
5866
app.http.server.configuration.hostname = Environment.process.PARSE_SERVER_SWIFT_HOST_NAME ?? "localhost"
5967
app.http.server.configuration.port = Int(Environment.process.PARSE_SERVER_SWIFT_PORT ?? 8080)
@@ -88,16 +96,20 @@ public struct ParseServerConfiguration {
8896
needs to be one server.
8997
- throws: An error of `ParseError` type.
9098
*/
91-
public init(app: Application,
92-
hostName: String = "localhost",
93-
port: Int = 8080,
94-
tlsConfiguration: TLSConfiguration? = nil,
95-
maxBodySize: ByteCount = "16kb",
96-
applicationId: String,
97-
primaryKey: String,
98-
webhookKey: String? = nil,
99-
parseServerURLString: String) throws {
99+
public init(
100+
app: Application,
101+
hostName: String = "localhost",
102+
port: Int = 8080,
103+
tlsConfiguration: TLSConfiguration? = nil,
104+
maxBodySize: ByteCount = "16kb",
105+
applicationId: String,
106+
maintenanceKey: String? = nil,
107+
primaryKey: String,
108+
webhookKey: String? = nil,
109+
parseServerURLString: String
110+
) throws {
100111
self.applicationId = applicationId
112+
self.maintenanceKey = maintenanceKey
101113
self.primaryKey = primaryKey
102114
self.webhookKey = webhookKey
103115

Tests/ParseServerSwiftTests/AppTests.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ final class AppTests: XCTestCase {
1616
hostName: "hostName",
1717
port: 8080,
1818
applicationId: "applicationId",
19+
maintenanceKey: "maintenanceKey",
1920
primaryKey: "primaryKey",
2021
webhookKey: hookKey,
21-
parseServerURLString: "primaryKey"
22+
parseServerURLString: "http://localhost:1337/1"
2223
)
2324
try await ParseServerSwift.initialize(
2425
configuration,
@@ -35,6 +36,7 @@ final class AppTests: XCTestCase {
3536
try await ParseSwift.initialize(
3637
applicationId: configuration.applicationId,
3738
primaryKey: configuration.primaryKey,
39+
maintenanceKey: configuration.maintenanceKey,
3840
serverURL: parseServerURL,
3941
usingPostForQuery: true,
4042
requestCachePolicy: .reloadIgnoringLocalCacheData
@@ -59,8 +61,9 @@ final class AppTests: XCTestCase {
5961
hostName: "hostName",
6062
port: 8080,
6163
applicationId: "applicationId",
64+
maintenanceKey: "maintenanceKey",
6265
primaryKey: "primaryKey",
63-
parseServerURLString: "primaryKey"
66+
parseServerURLString: "http://localhost:1337/1"
6467
)
6568
XCTAssertNoThrow(try setConfiguration(configuration))
6669
try await app.asyncShutdown()
@@ -73,8 +76,9 @@ final class AppTests: XCTestCase {
7376
hostName: "hostName",
7477
port: 8080,
7578
applicationId: "applicationId",
79+
maintenanceKey: "maintenanceKey",
7680
primaryKey: "primaryKey",
77-
parseServerURLString: "primaryKey"
81+
parseServerURLString: "http://localhost:1337/1"
7882
)
7983
XCTAssertThrowsError(try setConfiguration(configuration))
8084
try await app.asyncShutdown()

docker-compose.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ version: '3.7'
1717
x-shared_environment: &shared_environment
1818
LOG_LEVEL: ${LOG_LEVEL:-debug}
1919
PARSE_SERVER_APPLICATION_ID: ${PARSE_SERVER_APPLICATION_ID}
20+
PARSE_SERVER_MAINTENANCE_KEY: ${PARSE_SERVER_MAINTENANCE_KEY}
2021
PARSE_SERVER_PRIMARY_KEY: ${PARSE_SERVER_PRIMARY_KEY}
2122
PARSE_SERVER_READ_ONLY_PRIMARY_KEY: 367F7395-2E3A-46B1-ABA3-963A25D533C3
2223
PARSE_SERVER_WEBHOOK_KEY: ${PARSE_SERVER_WEBHOOK_KEY}
@@ -30,14 +31,17 @@ x-shared_environment: &shared_environment
3031
PARSE_SERVER_MOUNT_GRAPHQL: 'false'
3132
PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION: 'true' # Don't allow classes to be created on the client side. You can create classes by using ParseDashboard instead
3233
PARSE_SERVER_ALLOW_CUSTOM_OBJECTID: 'true' # Required to be true for ParseCareKit
33-
PARSE_SERVER_ENABLE_SCHEMA_HOOKS: 'true' # When this is true, only need one server for PARSE_SERVER_SWIFT_URLS
34+
PARSE_SERVER_ENABLE_SCHEMA_HOOKS: 'true' # When this is true, only need one server for PARSE_SERVER_SWIFT_URLS
35+
PARSE_SERVER_ENCODE_PARSE_OBJECT_IN_CLOUD_FUNCTION: 'true'
36+
PARSE_SERVER_PAGES_ENABLE_ROUTER": 'true'
3437
PARSE_SERVER_DIRECT_ACCESS: 'false' # WARNING: Setting to 'true' is known to cause crashes on parse-hipaa running postgres
3538
PARSE_SERVER_ENABLE_PRIVATE_USERS: 'true'
3639
PARSE_SERVER_USING_PARSECAREKIT: 'false' # If you are not using ParseCareKit, set this to 'false'
37-
PARSE_SERVER_RATE_LIMIT: 'true'
40+
PARSE_SERVER_RATE_LIMIT: 'false'
3841
PARSE_SERVER_RATE_LIMIT_REQUEST_COUNT: '100'
3942
PARSE_SERVER_RATE_LIMIT_INCLUDE_PRIMARY_KEY: 'false'
4043
PARSE_SERVER_RATE_LIMIT_INCLUDE_INTERNAL_REQUESTS: 'false'
44+
PARSE_SERVER_LIVEQUERY_CLASSNAMES: 'GameScore'
4145
PARSE_DASHBOARD_START: 'true'
4246
PARSE_DASHBOARD_APP_NAME: Parse HIPAA
4347
PARSE_DASHBOARD_USERNAMES: parse, parseRead
@@ -47,6 +51,7 @@ x-shared_environment: &shared_environment
4751
PARSE_DASHBOARD_COOKIE_SESSION_SECRET: AB8849B6-D725-4A75-AA73-AB7103F0363F # This should be constant across all deployments on your system
4852
PARSE_DASHBOARD_MOUNT_PATH: /dashboard # This needs to be exactly what you plan it to be behind the proxy, i.e. If you want to access cs.uky.edu/dashboard it should be "/dashboard"
4953
PARSE_VERBOSE: 'false'
54+
POSTGRES_USER: ${POSTGRES_USER}
5055
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Needed for wait-for-postgres.sh
5156

5257
services:
@@ -61,6 +66,7 @@ services:
6166
PARSE_SERVER_SWIFT_DEFAULT_MAX_BODY_SIZE: 16kb
6267
PARSE_SERVER_SWIFT_URLS: http://parse:1337/parse #,http://parse2:1337/parse # Only need to list one server.
6368
PARSE_SERVER_SWIFT_APPLICATION_ID: ${PARSE_SERVER_APPLICATION_ID}
69+
PARSE_SERVER_SWIFT_MAINTENANCE_KEY: ${PARSE_SERVER_MAINTENANCE_KEY}
6470
PARSE_SERVER_SWIFT_PRIMARY_KEY: ${PARSE_SERVER_PRIMARY_KEY}
6571
PARSE_SERVER_SWIFT_WEBHOOK_KEY: ${PARSE_SERVER_WEBHOOK_KEY}
6672
# ports:
@@ -74,9 +80,7 @@ services:
7480
depends_on:
7581
- parse
7682
parse:
77-
image: netreconlab/parse-hipaa:6.4.0-dashboard
78-
# Uncomment the image below to use Parse Server 5.4.0 instead. Be sure to comment out 6.0.0x
79-
#image: netreconlab/parse-hipaa:5.4.0-dashboard
83+
image: netreconlab/parse-hipaa:8.0.1-dashboard
8084
environment:
8185
<<: *shared_environment
8286
PARSE_SERVER_URL: http://parse:${PORT}${MOUNT_PATH}
@@ -87,8 +91,6 @@ services:
8791
volumes:
8892
- ./parse/wait-for-postgres.sh:/parse-server/wait-for-postgres.sh
8993
- ./parse/index.js:/parse-server/index.js
90-
# Uncomment the mount below to use Parse Server 5.4.0 instead. Be sure to comment out the index.js mount above
91-
#- ./parse/index-5.4.0.js:/parse-server/index.js
9294
- ./parse/cloud:/parse-server/cloud
9395
- ./parse/files:/parse-server/files # All files uploaded from users are stored to an ecrypted drive locally for HIPAA compliance
9496
restart: always

0 commit comments

Comments
 (0)