Update snippet in server.md (#954)

Use `makeServerConfiguration` instead of deprecated `forServer`.
This commit is contained in:
Valeriy Van 2023-12-13 14:57:18 +02:00 committed by GitHub
parent 38d4edd812
commit fafc8baf14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -130,8 +130,8 @@ Der Parameter _tlsConfiguration_ legt fest, ob TLS (SSL) verwendet werden soll.
/// [configure.swift]
// Enable TLS.
try app.http.server.configuration.tlsConfiguration = .forServer(
certificateChain: NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
app.http.server.configuration.tlsConfiguration = .makeServerConfiguration(
certificateChain: try NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
privateKey: .file("/path/to/key.pem")
)
```

View File

@ -139,8 +139,8 @@ The `tlsConfiguration` parameter controls whether TLS (SSL) is enabled on the se
```swift
// Enable TLS.
try app.http.server.configuration.tlsConfiguration = .forServer(
certificateChain: NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
app.http.server.configuration.tlsConfiguration = .makeServerConfiguration(
certificateChain: try NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
privateKey: .file("/path/to/key.pem")
)
```

View File

@ -139,8 +139,8 @@ De `tlsConfiguration` parameter regelt of TLS (SSL) is ingeschakeld op de server
```swift
// Schakel TLS in.
try app.http.server.configuration.tlsConfiguration = .forServer(
certificateChain: NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
app.http.server.configuration.tlsConfiguration = .makeServerConfiguration(
certificateChain: try NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
privateKey: .file("/path/to/key.pem")
)
```

View File

@ -138,8 +138,8 @@ app.http.server.configuration.supportVersions = [.two]
```swift
// 启用 TLS.
try app.http.server.configuration.tlsConfiguration = .forServer(
certificateChain: NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
app.http.server.configuration.tlsConfiguration = .makeServerConfiguration(
certificateChain: try NIOSSLCertificate.fromPEMFile("/path/to/cert.pem").map { .certificate($0) },
privateKey: .file("/path/to/key.pem")
)
```