Skip to content

Commit

Permalink
Update examples with HB2-beta.5 (#80)
Browse files Browse the repository at this point in the history
* update all the examples (except ios) with hb2-beta.5, add scripts & Makefile

* remove submodule

* add swift format

* revert to swiftformat & fix checks

* fix format in makefile

* fix todos mongokitten

* fix yoda conditions for mongokitten when formatting code

* remove makefile & scripts, add back .git & unsafe flags

* add empty test for mongo example
  • Loading branch information
tib authored May 27, 2024
1 parent dced271 commit f32154a
Show file tree
Hide file tree
Showing 70 changed files with 764 additions and 476 deletions.
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--exclude .build

# rules
--disable redundantReturn, extensionAccessControl, unusedArguments
--disable redundantReturn, extensionAccessControl, unusedArguments, yodaconditions

# format options
--ifdef no-indent
Expand Down
12 changes: 6 additions & 6 deletions auth-cognito/Package.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "auth-cognito",
platforms: [.macOS(.v14)],
platforms: [
.macOS(.v14),
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.1"),
.package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-beta.1"),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.5"),
.package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-beta.2"),
.package(url: "https://github.com/adam-fowler/soto-cognito-authentication-kit.git", from: "5.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"),
],
targets: [
.executableTarget(
Expand Down
12 changes: 9 additions & 3 deletions auth-cognito/Sources/App/Application+build.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AsyncHTTPClient
import Hummingbird
import HummingbirdAuth
import HummingbirdRouter
Expand All @@ -14,9 +15,11 @@ struct AWSClientService: Service {
}
}

func buildApplication(configuration: ApplicationConfiguration) async throws -> some ApplicationProtocol {
func buildApplication(
configuration: ApplicationConfiguration
) async throws -> some ApplicationProtocol {
// setup Soto
let awsClient = AWSClient(httpClientProvider: .createNew)
let awsClient = AWSClient(httpClient: HTTPClient.shared)
let cognitoIdentityProvider = CognitoIdentityProvider(client: awsClient, region: .euwest1)
// setup SotoCognitoAuthentication
let env = try await Environment().merging(with: .dotEnv())
Expand All @@ -36,7 +39,10 @@ func buildApplication(configuration: ApplicationConfiguration) async throws -> s

let router = RouterBuilder(context: AuthCognitoRequestContext.self) {
AWSErrorMiddleware()
UserController(cognitoAuthenticatable: authenticatable, cognitoIdentityProvider: cognitoIdentityProvider).endpoints
UserController(
cognitoAuthenticatable: authenticatable,
cognitoIdentityProvider: cognitoIdentityProvider
).endpoints
}

var app = Application(router: router)
Expand Down
Loading

0 comments on commit f32154a

Please sign in to comment.