Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Application_NMeta

siemensikkema edited this page Sep 10, 2020 · 2 revisions

Application.NMeta

struct NMeta

Initializers

init(headerName:​platforms:​environments:​exceptPaths:​requiredEnvironments:​)

Create a new NMeta configuration value.

public init(headerName:​ String = "N-Meta", platforms:​ [String] = ["web", "android", "ios"], environments:[String] = ["local", "development", "staging", "production"], exceptPaths:[String] = ["/js/*", "/css/*", "/images/*", "/favicons/*", "/admin/*"], requiredEnvironments:​ [String] = ["local", "development", "staging", "production"])

Parameters

  • headerName:​ the request header where NMeta data will be extracted from
  • platforms:​ supported platforms
  • environments:​ supported environments
  • exceptPaths:​ paths to ignore NMeta requirement on. Must start with / and may end with /* to match all sub-paths.
  • requiredEnvironments:​ environments to check NMeta header for

Properties

headerName

Request header where NMeta data will be extracted from

var headerName:​ String

platforms

Supported platforms

var platforms:[String]

environments

Supported environments

var environments:[String]

exceptPaths

Ignore requirement on following paths

var exceptPaths:[String]

requiredEnvironments

Only check header on following environments

var requiredEnvironments:[String]

Methods

assertValid(request:​)

func assertValid(request:​ Request) throws

isMetaRequired(request:​)

private func isMetaRequired(request:​ Request) throws -> Bool

metaOrFail(request:​)

private func metaOrFail(request:​ Request) throws -> Request.NMeta