mirror of https://github.com/vapor/docs.git
Update snippet in server.md (#954)
Use `makeServerConfiguration` instead of deprecated `forServer`.
This commit is contained in:
parent
38d4edd812
commit
fafc8baf14
|
|
@ -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")
|
||||
)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
)
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue