Configuration SchemaΒΆ

This page shows the schema of the exodus-lambda config file, usually named lambda_config.json, in JSON schema format (encoded as YAML).

The latest version of this schema is available in raw form at https://release-engineering.github.io/exodus-lambda/lambda_config.yaml.

# Schema, in json-schema format, for the primary config file consumed
# by exodus-lambda.

$id: https://release-engineering.github.io/exodus-lambda/lambda_config.yaml

$schema: https://json-schema.org/draft/2020-12/schema

title: exodus-lambda config
description: Primary configuration object for exodus-lambda
type: object

properties:
  table:
    description: DynamoDB table used for content
    $ref: '#/definitions/table'

  config_table:
    description: DynamoDB table used for config
    $ref: '#/definitions/table'

  config_cache_ttl:
    type: integer
    description: >-
      How long, in minutes, to cache config loaded from the config_table
    maximum: 10000
    minimum: 0

  connect_timeout:
    type: integer
    description: >-
      The time, in seconds, before timeout when attempting to make a connection
    maximum: 10000
    minimum: 0

  read_timeout:
    type: integer
    description: >-
      The time, in seconds, before timeout when attempting to read from a connection
    maximum: 10000
    minimum: 0

  headers:
    type: object
    properties:
      max_age:
        description: >-
          Value of max-age field (seconds) in Cache-Control headers produced
          for responses dealing with mutable files, such as repo entry points
        maximum: 1000000
        minimum: 0
        type: integer
    additionalProperties: false
    required:
    - max_age

  strip_headers:
    type: array
    description: >-
      List of header prefixes to strip from responses.
      Any headers starting with any of these strings will be removed from
      S3 responses in the origin_response lambda.
    items:
      type: string
      maxLength: 100
      minLength: 1

  index_filename:
    type: string
    description: >-
      Basename of index file to be automatically served in response to requests
      for a "directory" listing.
    maxLength: 500
    minLength: 1

  lambda_version:
    type: string
    description: >-
      Value returned in X-Exodus-Version header; generally should contain git
      revision and possibly a build timestamp
    maxLength: 500
    minLength: 1

  logging:
    description: >-
      Logging config dict, as used by `logging.dictConfig` in python stdlib
    $ref: '#/definitions/logging'

required:
# In practice, we provide most properties in the config file all the time,
# so we list them as required.
#
# It is possible that the code applies some defaults and so some of
# these aren't truly required. This was not investigated when the schema
# was written.
#
# If needed, you can remove elements from this list after confirming the
# code can handle their absence.
- table
- config_table
- config_cache_ttl
- connect_timeout
- read_timeout
- headers
- lambda_version
- index_filename
- logging

# No properties should be defined other than those listed above.
additionalProperties: false

# Shared definitions referenced from above schema.
definitions:
  aws_region:
    description: AWS region name (e.g. us-east-1)
    pattern: ^[a-z0-9_\-]{1,30}$
    type: string
  logging:
    description: Dict for logging.dictConfig
    # This is not a definitive schema for logging.dictConfig, we only
    # define a schema supporting the fields we use and with enough
    # detail to catch basic mistakes.
    properties:
      disable_existing_loggers:
        type: boolean
      formatters:
        type: object
      incremental:
        type: boolean
      loggers:
        patternProperties:
          .:
            additionalProperties: false
            properties:
              level:
                enum:
                - INFO
                - DEBUG
                - WARNING
                - ERROR
            required:
            - level
            type: object
        type: object
      version:
        const: 1
    type: object
  table:
    type: object
    description: Config for a DynamoDB table
    properties:
      available_regions:
        type: array
        description: >-
          Regions in which copies of the table are available.

          Order matters; earlier regions are higher priority.
        items:
          $ref: '#/definitions/aws_region'
        minItems: 1
      name:
        type: string
        description: Name of a DynamoDB table
        maxLength: 100
        minLength: 1
    required:
    - name
    - available_regions
    additionalProperties: false