Skip to content

Commit

Permalink
Further doc updates for new template
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim committed Apr 27, 2023
1 parent fb66441 commit 7087aa3
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 47 deletions.
24 changes: 14 additions & 10 deletions docs/basics/environment.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,22 @@ extension Environment {
}
```

Die laufende Umgebung wird standardmäßig in der Datei _main_ über die Methode _detect()_ erkannt und gesetzt:
Die laufende Umgebung wird standardmäßig in der Datei _entrypoint_ über die Methode _detect()_ erkannt und gesetzt:

```swift
// [main.swift]

import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }
@main
enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }

try await configure(app)
try await app.runFromAsyncMainEntrypoint()
}
}
```

Die Methode greift auf die Argumente der Befehlzeile zu und zieht sich den entsprechenden Wert für das Argument _--env_.
Expand Down
22 changes: 14 additions & 8 deletions docs/basics/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,22 @@ extension Environment {
}
```

The application's environment is usually set in `main.swift` using `Environment.detect()`.
The application's environment is usually set in `entrypoint.swift` using `Environment.detect()`.

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }
@main
enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }

try await configure(app)
try await app.runFromAsyncMainEntrypoint()
}
}
```

The `detect` method uses the process's command line arguments and parses the `--env` flag automatically. You can override this behavior by initializing a custom `Environment` struct.
Expand Down
22 changes: 14 additions & 8 deletions docs/basics/environment.nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,22 @@ extension Environment {
}
```

De omgeving van de applicatie wordt meestal ingesteld in `main.swift` met `Environment.detect()`.
De omgeving van de applicatie wordt meestal ingesteld in `entrypoint.swift` met `Environment.detect()`.

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }
@main
enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }

try await configure(app)
try await app.runFromAsyncMainEntrypoint()
}
}
```

De `detect` methode gebruikt de commandoregel argumenten van het proces en parst de `--env` vlag automatisch. Je kunt dit gedrag opheffen door een aangepaste `Environment` struct te initialiseren.
Expand Down
22 changes: 14 additions & 8 deletions docs/basics/environment.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,22 @@ extension Environment {
}
```

应用程序的环境通常使用 `main.swift` 中的 `environment .detect()` 来设置。
应用程序的环境通常使用 `entrypoint.swift` 中的 `environment .detect()` 来设置。

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }
@main
enum Entrypoint {
static func main() async throws {
var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }

try await configure(app)
try await app.runFromAsyncMainEntrypoint()
}
}
```

`detect` 方法使用进程的命令行参数并自动解析 `--env` 标志。你可以通过初始化自定义的 `Environment` 结构来覆盖此行为。
Expand Down
4 changes: 1 addition & 3 deletions docs/basics/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ Both of these can be done in Xcode by editing the `App` scheme.

## Configuration

SwiftLog is configured by bootstrapping the `LoggingSystem` once per process. Vapor projects typically do this in `main.swift`.
SwiftLog is configured by bootstrapping the `LoggingSystem` once per process. Vapor projects typically do this in `entrypoint.swift`.

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
```
Expand Down
4 changes: 1 addition & 3 deletions docs/basics/logging.nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ Beide kunnen worden gedaan in Xcode door het `App` schema te bewerken.

## Configuratie

SwiftLog wordt geconfigureerd door het `LoggingSystem` één keer per proces te bootstrappen. Vapor projecten doen dit meestal in `main.swift`.
SwiftLog wordt geconfigureerd door het `LoggingSystem` één keer per proces te bootstrappen. Vapor projecten doen dit meestal in `entrypoint.swift`.

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
```
Expand Down
4 changes: 1 addition & 3 deletions docs/basics/logging.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@ vapor run serve

## 配置

SwiftLog 可以通过每次进程启动 `LoggingSystem` 时进行配置。Vapor 项目通常在 `main.swift` 执行操作。
SwiftLog 可以通过每次进程启动 `LoggingSystem` 时进行配置。Vapor 项目通常在 `entrypoint.swift` 执行操作。

```swift
import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/folder-structure.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Der Ordner _Models_ beinhaltet die Klassendefinitionen für die Entitäten.

#### configure.swift

Die Datei _configure.swift_ umfasst die Methode `configure(_:)`. Sie wird in der Datei `main.swift` aufgerufen um die Anwendung mit entsprechenden Angaben zu Endpunkten, zur Datenbank oder zu Providern zu konfigurieren.
Die Datei _configure.swift_ umfasst die Methode `configure(_:)`. Sie wird in der Datei `entrypoint.swift` aufgerufen um die Anwendung mit entsprechenden Angaben zu Endpunkten, zur Datenbank oder zu Providern zu konfigurieren.

#### entrypoint.swift

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The models folder is a great place to store your `Content` structs or Fluent `Mo

#### configure.swift

This file contains the `configure(_:)` function. This method is called by `main.swift` to configure the newly created `Application`. This is where you should register services like routes, databases, providers, and more.
This file contains the `configure(_:)` function. This method is called by `entrypoint.swift` to configure the newly created `Application`. This is where you should register services like routes, databases, providers, and more.

#### entrypoint.swift

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/folder-structure.nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ De models map is een goede plaats om uw `Content` structs of Fluent `Model`s op

#### configure.swift

Dit bestand bevat de `configure(_:)` functie. Deze methode wordt aangeroepen door `main.swift` om de nieuw aangemaakte `Application` te configureren. Dit is waar je services zoals routes, databases, providers, en meer moet registreren.
Dit bestand bevat de `configure(_:)` functie. Deze methode wordt aangeroepen door `entrypoint.swift` om de nieuw aangemaakte `Application` te configureren. Dit is waar je services zoals routes, databases, providers, en meer moet registreren.

#### entrypoint.swift

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/folder-structure.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ models 文件夹常用于存放 `Content` 和 Fluent `Model` 的类或结构体

#### configure.swift

这个文件包含 `configure(_:)` 函数,`main.swift` 调用这个方法用以配置新创建的 `Application` 实例。你可以在这里注册诸如路由、数据库、providers 等服务。
这个文件包含 `configure(_:)` 函数,`entrypoint.swift` 调用这个方法用以配置新创建的 `Application` 实例。你可以在这里注册诸如路由、数据库、providers 等服务。

#### entrypoint.swift

Expand Down

0 comments on commit 7087aa3

Please sign in to comment.