diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..bb56973
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+.build/*
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Bootstrap.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Bootstrap.xcscheme
new file mode 100644
index 0000000..fc5f894
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/Bootstrap.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Client.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Client.xcscheme
new file mode 100644
index 0000000..543cd43
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/Client.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/ClientLive.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/ClientLive.xcscheme
new file mode 100644
index 0000000..3327fe3
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/ClientLive.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/DewPointEnvironment.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/DewPointEnvironment.xcscheme
new file mode 100644
index 0000000..1a3b0b2
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/DewPointEnvironment.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/EnvVars.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/EnvVars.xcscheme
new file mode 100644
index 0000000..1983919
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/EnvVars.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme
new file mode 100644
index 0000000..4435fa7
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller-Package.xcscheme
new file mode 100644
index 0000000..e1db4cc
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller-Package.xcscheme
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller.xcscheme
new file mode 100644
index 0000000..7e9546e
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/dewPoint-controller.xcscheme
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ea0eb7e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,13 @@
+FROM swift as build
+WORKDIR /build
+COPY ./Package.* ./
+RUN swift package resolve
+COPY . .
+RUN swift build --enable-test-discovery -c release -Xswiftc -g
+
+# Run image
+FROM swift
+WORKDIR /run
+COPY --from=build /build/.build/release /run
+
+
diff --git a/Package.resolved b/Package.resolved
index 376196a..7777430 100644
--- a/Package.resolved
+++ b/Package.resolved
@@ -3,11 +3,11 @@
"pins": [
{
"package": "mqtt-nio",
- "repositoryURL": "https://github.com/adam-fowler/mqtt-nio.git",
+ "repositoryURL": "https://github.com/swift-server-community/mqtt-nio.git",
"state": {
"branch": null,
- "revision": "976a4b6019e1dd365a0da793babadd5cc958ce2b",
- "version": "2.1.1"
+ "revision": "ca8af7a30c4690456ce7de276cd0f037489ba707",
+ "version": "2.5.3"
}
},
{
@@ -33,8 +33,8 @@
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
- "revision": "5e68c1ded15619bb281b273fa8c2d8fd7f7b2b7d",
- "version": "2.16.1"
+ "revision": "b5260a31c2a72a89fa684f5efb3054d8725a2316",
+ "version": "2.18.0"
}
},
{
@@ -42,8 +42,8 @@
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
"state": {
"branch": null,
- "revision": "e7f5278a26442dc46783ba7e063643d524e414a0",
- "version": "1.11.3"
+ "revision": "8ab824b140d0ebcd87e9149266ddc353e3705a3e",
+ "version": "1.11.4"
}
},
{
diff --git a/Package.swift b/Package.swift
index 7186b7b..1196a3c 100644
--- a/Package.swift
+++ b/Package.swift
@@ -5,7 +5,7 @@ import PackageDescription
let package = Package(
name: "dewPoint-controller",
platforms: [
- .macOS(.v10_14)
+ .macOS(.v10_15)
],
products: [
.executable(name: "dewPoint-controller", targets: ["dewPoint-controller"]),
@@ -17,7 +17,7 @@ let package = Package(
.library(name: "ClientLive", targets: ["ClientLive"]),
],
dependencies: [
- .package(url: "https://github.com/adam-fowler/mqtt-nio.git", from: "2.0.0"),
+ .package(url: "https://github.com/swift-server-community/mqtt-nio.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.0.0"),
.package(url: "https://github.com/swift-psychrometrics/swift-psychrometrics", from: "0.1.0")
],
diff --git a/Sources/Bootstrap/Bootstrap.swift b/Sources/Bootstrap/Bootstrap.swift
index 0f377b7..c560dd8 100644
--- a/Sources/Bootstrap/Bootstrap.swift
+++ b/Sources/Bootstrap/Bootstrap.swift
@@ -39,6 +39,7 @@ private func loadEnvVars(
logger?.debug("Loading env vars...")
+ // TODO: Need to have the env file path passed in / dynamic.
let envFilePath = URL(fileURLWithPath: #file)
.deletingLastPathComponent()
.deletingLastPathComponent()
diff --git a/Sources/ClientLive/Helpers.swift b/Sources/ClientLive/Helpers.swift
index b46f86a..f468dd5 100644
--- a/Sources/ClientLive/Helpers.swift
+++ b/Sources/ClientLive/Helpers.swift
@@ -3,6 +3,7 @@ import Logging
import Models
import MQTTNIO
import NIO
+import NIOFoundationCompat
import Psychrometrics
/// Represents a type that can be initialized by a ``ByteBuffer``.
@@ -14,7 +15,10 @@ extension Double: BufferInitalizable {
/// Attempt to create / parse a double from a byte buffer.
init?(buffer: inout ByteBuffer) {
- guard let string = buffer.readString(length: buffer.readableBytes, encoding: .utf8)
+ guard let string = buffer.readString(
+ length: buffer.readableBytes,
+ encoding: String.Encoding.utf8
+ )
else { return nil }
self.init(string)
}
diff --git a/docker-compose.yaml b/docker-compose.yaml
index e821fe6..f17e16d 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -1,25 +1,28 @@
# run this with docker-compose -f docker/docker-compose.yml run test
-version: "3.3"
+version: "3"
services:
test:
- image: swift:5.3
- working_dir: /dewPoint-controller
+ #image: swift:latest
+ build:
+ context: ./
+ platform: linux/amd64
+ working_dir: /app
volumes:
- - .:/dewPoint-controller
+ - .:/app
depends_on:
- mosquitto
environment:
- MOSQUITTO_SERVER=mosquitto
- command: /bin/bash -xcl "swift test --enable-test-discovery --sanitize=thread"
+ command: "swift package clean && swift test"
mosquitto:
image: eclipse-mosquitto
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/certs:/mosquitto/certs
- ports:
- - "1883:1883"
- - "8883:8883"
- - "8080:8080"
- - "8081:8081"
+ #ports:
+ #- "1883:1883"
+ #- "8883:8883"
+ #- "8080:8080"
+ #- "8081:8081"