Skip to content

Commit

Permalink
fix: Set default port to 8080 (#57)
Browse files Browse the repository at this point in the history
* fix: Set default port to 8080

* adjust docker port

* Update AppTests.swift

* Update docker-compose.yml

* Update Configuring Parse Server Swift.tutorial
  • Loading branch information
cbaker6 authored Jan 13, 2024
1 parent 8cdfa86 commit 2f5420e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ COPY --from=build --chown=vapor:vapor /staging /app
# Ensure all further commands run as the vapor user
USER vapor:vapor

# Let Docker bind to port 8081
EXPOSE 8081
# Let Docker bind to port 8080
EXPOSE 8080

# Start the Vapor service when the image is run, default to listening on 8081 in production environment
ENTRYPOINT ["./App"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8081"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
@Section(title: "Hostname, Port, and TLS") {
@Steps {
@Step {
By default, the hostname is `127.0.0.1` and the port is `8081`. These values can easily be changed:
By default, the hostname is `127.0.0.1` and the port is `8080`. These values can easily be changed:
```swift
app.http.server.configuration.hostname = "your.hostname.com"
app.http.server.configuration.port = 8081
app.http.server.configuration.port = 8080
app.http.server.configuration.tlsConfiguration = .none
```
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/ParseServerSwift/ParseServerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public struct ParseServerConfiguration {
self.applicationId = applicationId
self.primaryKey = primaryKey
app.http.server.configuration.hostname = Environment.process.PARSE_SERVER_SWIFT_HOST_NAME ?? "localhost"
app.http.server.configuration.port = Int(Environment.process.PARSE_SERVER_SWIFT_PORT ?? 8081)
app.http.server.configuration.port = Int(Environment.process.PARSE_SERVER_SWIFT_PORT ?? 8080)
app.http.server.configuration.tlsConfiguration = tlsConfiguration
// swiftlint:disable:next line_length
app.routes.defaultMaxBodySize = ByteCount(stringLiteral: Environment.process.PARSE_SERVER_SWIFT_DEFAULT_MAX_BODY_SIZE ?? "16kb")
Expand Down Expand Up @@ -90,7 +90,7 @@ public struct ParseServerConfiguration {
*/
public init(app: Application,
hostName: String = "localhost",
port: Int = 8081,
port: Int = 8080,
tlsConfiguration: TLSConfiguration? = nil,
maxBodySize: ByteCount = "16kb",
applicationId: String,
Expand Down
6 changes: 3 additions & 3 deletions Tests/ParseServerSwiftTests/AppTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class AppTests: XCTestCase {
let app = Application(.testing)
let configuration = try ParseServerConfiguration(app: app,
hostName: "hostName",
port: 8081,
port: 8080,
applicationId: "applicationId",
primaryKey: "primaryKey",
webhookKey: hookKey,
Expand Down Expand Up @@ -46,7 +46,7 @@ final class AppTests: XCTestCase {
defer { app.shutdown() }
let configuration = try ParseServerConfiguration(app: app,
hostName: "hostName",
port: 8081,
port: 8080,
applicationId: "applicationId",
primaryKey: "primaryKey",
parseServerURLString: "primaryKey")
Expand All @@ -58,7 +58,7 @@ final class AppTests: XCTestCase {
defer { app.shutdown() }
let configuration = try ParseServerConfiguration(app: app,
hostName: "hostName",
port: 8081,
port: 8080,
applicationId: "applicationId",
primaryKey: "primaryKey",
parseServerURLString: "primaryKey")
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ services:
environment:
<<: *shared_environment
PARSE_SERVER_SWIFT_HOST_NAME: cloud-code # Should be same name as docker service
PARSE_SERVER_SWIFT_PORT: 8081
PARSE_SERVER_SWIFT_PORT: 8080
PARSE_SERVER_SWIFT_DEFAULT_MAX_BODY_SIZE: 16kb
PARSE_SERVER_SWIFT_URLS: http://parse:1337/parse #,http://parse2:1337/parse # Only need to list one server.
PARSE_SERVER_SWIFT_APPLICATION_ID: ${PARSE_SERVER_APPLICATION_ID}
PARSE_SERVER_SWIFT_PRIMARY_KEY: ${PARSE_SERVER_PRIMARY_KEY}
PARSE_SERVER_SWIFT_WEBHOOK_KEY: ${PARSE_SERVER_WEBHOOK_KEY}
# ports:
# - '8081:8081'
# - '8081:8080'
# user: '0' # uncomment to run as root for testing purposes even though Dockerfile defines 'vapor' user.
restart: always
command: ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8081"]
command: ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
# volumes:
# - ./.env:/app/.env
# - ./.env.production:/app/.env.production # Mount production environment if you have one.
Expand Down

0 comments on commit 2f5420e

Please sign in to comment.