Skip to content

Type Method

secret(key:)

Reads a file’s content for a secret. The secret key is the name of the environment variable that is expected to specify the path of the file containing the secret.
static func secret(key: String) async throws -> String?

Parameters

key

The environment variable name

Discussion

Example usage:

func configure(_ app: Application) async throws {
    // ...

    let databasePassword = try await Environment.secret(key: "DATABASE_PASSWORD_FILE")