From c32880ee3ee9ce5e7d899d4741a5608525889dd9 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Sun, 15 Nov 2020 15:43:44 -0800 Subject: [PATCH] Configure sessions and store them in databases --- .gitignore | 3 +- Package.resolved | 54 ++++++++++++++++++++++++++++++++++++ Package.swift | 6 +++- Resources/db.sqlite | Bin 0 -> 28672 bytes Sources/App/configure.swift | 11 +++++++- 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 Resources/db.sqlite diff --git a/.gitignore b/.gitignore index 5d72a4a..b383d5c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ xcuserdata DerivedData/ .DS_Store file:* -Resources/config.json \ No newline at end of file +Resources/config.json +Resources/db.sqlite \ No newline at end of file diff --git a/Package.resolved b/Package.resolved index 27f968a..eb10d4e 100644 --- a/Package.resolved +++ b/Package.resolved @@ -28,6 +28,33 @@ "version": "4.2.1" } }, + { + "package": "fluent", + "repositoryURL": "https://github.com/vapor/fluent.git", + "state": { + "branch": null, + "revision": "e681c93df3201a2d8ceef15e8a9a0634578df233", + "version": "4.0.0" + } + }, + { + "package": "fluent-kit", + "repositoryURL": "https://github.com/vapor/fluent-kit.git", + "state": { + "branch": null, + "revision": "31d96b547cc1f869f2885d932a8a9a7ae2103fc6", + "version": "1.10.0" + } + }, + { + "package": "fluent-sqlite-driver", + "repositoryURL": "https://github.com/vapor/fluent-sqlite-driver.git", + "state": { + "branch": null, + "revision": "6f29f6f182c812075f09c7575c18ac5535c26824", + "version": "4.0.1" + } + }, { "package": "leaf", "repositoryURL": "https://github.com/vapor/leaf", @@ -64,6 +91,33 @@ "version": "4.2.0" } }, + { + "package": "sql-kit", + "repositoryURL": "https://github.com/vapor/sql-kit.git", + "state": { + "branch": null, + "revision": "ea9928b7f4a801b175a00b982034d9c54ecb6167", + "version": "3.7.0" + } + }, + { + "package": "sqlite-kit", + "repositoryURL": "https://github.com/vapor/sqlite-kit.git", + "state": { + "branch": null, + "revision": "2ec279b9c845cec254646834b66338551a024561", + "version": "4.0.2" + } + }, + { + "package": "sqlite-nio", + "repositoryURL": "https://github.com/vapor/sqlite-nio.git", + "state": { + "branch": null, + "revision": "6481dd0b01112d082dd7eb362782126e81964138", + "version": "1.1.0" + } + }, { "package": "swift-backtrace", "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", diff --git a/Package.swift b/Package.swift index 38be553..424827e 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,9 @@ let package = Package( .package(url: "https://github.com/vapor/leaf-kit", .exact("1.0.0-tau.1.1")), // Leaf Error Middleware for custom error pages .package(name: "LeafErrorMiddleware", url: "https://github.com/brokenhandsio/leaf-error-middleware.git", from: "2.0.0-beta"), - .package(url: "https://github.com/apple/swift-crypto.git", from: "1.1.2") + .package(url: "https://github.com/apple/swift-crypto.git", from: "1.1.2"), + .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"), + .package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.0.0") ], targets: [ .target( @@ -23,6 +25,8 @@ let package = Package( .product(name: "Vapor", package: "vapor"), .product(name: "Leaf", package: "leaf"), .product(name: "Crypto", package: "swift-crypto"), + .product(name: "Fluent", package: "fluent"), + .product(name: "FluentSQLiteDriver", package: "fluent-sqlite-driver"), "LeafErrorMiddleware" ], swiftSettings: [ diff --git a/Resources/db.sqlite b/Resources/db.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..072afd952314d4fe94af8de41029d4ee12c7f365 GIT binary patch literal 28672 zcmeI(L37eT7zW@3TCk27Z#_8U?BrrQ8cZO7aYk#h2^FPO1F7PLNnwlF0u_>4bv&p) z!lPF`dGL>T)2l~kym<5I0#j+xYI~}V?@pHNe!#cMlgS~=QodDe1&pk9du=};Y2lP0 zio#Vw1VK2#Yn<1e65)-hoetlNyW0CTPYB7y*9qyH5KEjBPWGjDQYUflWGeA>zb_yT z0SG_<0uX=z1Rwwb2teR35O_wX;OJp@;ZAYlZtbvLQ2cLdc`6SHvGVs$@TJb zX;+jkm&z5_ER-rl4j){a93nZ)}SqZ zKd9f6372yg9d{S0T<Gx0d3s%2-?lwvw5ThXbOQw+n_6;)Mpd0WdHS;NQ=XQqfK%=Nrw{~ z=7%rc>Gz+n?Cg*8^Ae?x0^d*|009U<00Izz00bZa0SG_<0ucDe1kOginS)FfjGq5L z3DT#3>;!SR5P$##AOHafKmY;|fB*y_009V$1uW3aX45MM1@}Uu!*cb@Po6eKo;Q`%vl)}x zwxZ@Tx}xVV8j5A*(~6$SU8EUJxAc52RZf+|`|47Qh1W7o>)~UIy2j?sP~WN=?D4w2 zw6@i<)3+DH`_;=&