SessionsConfig

public struct SessionsConfig : ServiceType

Configuration options for sessions.

  • See ServiceType

    Declaration

    Swift

    public static func makeService(for worker: Container) throws -> SessionsConfig
  • Creates a new HTTPCookieValue for the supplied value String.

    Declaration

    Swift

    public let cookieFactory: (String) -> HTTPCookieValue
  • Name of HTTP cookie, used as a key for the cookie value.

    Declaration

    Swift

    public let cookieName: String
  • Create a new SessionsConfig with the supplied cookie factory.

    let sessionsConfig = SessionsConfig(cookieName: "vapor-session") { value in
        return HTTPCookieValue(string: value, isSecure: true)
    }
    

    Declaration

    Swift

    public init(cookieName: String, cookieFactory: @escaping (String) -> HTTPCookieValue)

    Parameters

    cookieName

    Name of HTTP cookie, used as a key for the cookie value.

    cookieFactory

    Creates a new HTTPCookieValue for the supplied value String.

  • SessionsConfig with basic cookie factory.

    Declaration

    Swift

    public static func `default`() -> SessionsConfig