{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OrdinaryApiConfig",
  "description": "Config definition for an Ordinary API Instance",
  "type": "object",
  "properties": {
    "domain": {
      "type": "string"
    },
    "contacts": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "public_dns_ip": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "integer",
        "format": "uint8",
        "minimum": 0,
        "maximum": 255
      },
      "minItems": 4,
      "maxItems": 4
    },
    "env_name": {
      "type": "string",
      "default": "development"
    },
    "limits": {
      "$ref": "#/$defs/OrdinaryApiLimits",
      "default": {
        "app_domains": [],
        "privileged_domains": [],
        "max_default_timeout": 10,
        "proxy": {
          "count": 255,
          "disallowed_targets": []
        },
        "middleware": {
          "count": 65535,
          "disallowed_endpoints": []
        },
        "action": {
          "count": 255,
          "max_timeout": 10
        },
        "auth": {},
        "integration": {
          "count": 255,
          "max_timeout": 10
        },
        "monitor": {},
        "storage": {
          "max_storage": 20000000000,
          "max_app_storage": 50000000,
          "assets": {
            "allowed_extensions": [
              "otf",
              "ttf",
              "woff",
              "woff2",
              "txt",
              "xml",
              "html",
              "css",
              "css.map",
              "csv",
              "js",
              "png",
              "apng",
              "gif",
              "svg",
              "jpg",
              "jpeg",
              "bmp",
              "tif",
              "tiff",
              "webp",
              "avif",
              "ico",
              "pdf",
              "json",
              "wasm"
            ],
            "max_store_size": 100000000,
            "max_asset_size": 1500000
          },
          "artifact": {
            "max_store_size": 10000000,
            "max_artifact_size": 500000
          },
          "cache": {
            "max_size_range": [
              1000000,
              10000000
            ],
            "max_count_range": [
              100,
              500
            ],
            "clean_interval_ranges": [
              [
                5,
                10
              ],
              [
                15,
                20
              ]
            ]
          },
          "content": {
            "search_enabled": true,
            "max_content_definitions": 255,
            "max_content_fields": 255,
            "max_store_size": 10000000,
            "max_object_size": 400000,
            "max_field_size": 200000
          },
          "model": {
            "search_enabled": true,
            "max_model_definitions": 255,
            "max_model_fields": 255,
            "max_item_size": 400000,
            "max_field_size": 100000
          },
          "secrets": {
            "max_count": 225,
            "max_size": 2000
          }
        },
        "template": {
          "count": 255,
          "max_timeout": 10
        }
      }
    },
    "proxied_metrics": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProxiedMetric"
      },
      "default": []
    },
    "console": {
      "description": "whether to serve the web console",
      "type": "boolean",
      "default": false
    },
    "invite_token_link": {
      "description": "link to the location where you are able to obtain an invite token",
      "type": "string",
      "default": "/"
    }
  },
  "required": [
    "domain",
    "contacts"
  ],
  "$defs": {
    "OrdinaryApiLimits": {
      "type": "object",
      "properties": {
        "app_domains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "privileged_domains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "max_default_timeout": {
          "description": "Max default timeout for all HTTP requests.\n\nDefault: 10",
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535
        },
        "proxy": {
          "$ref": "#/$defs/ProxyLimits"
        },
        "middleware": {
          "$ref": "#/$defs/MiddlewareLimits"
        },
        "action": {
          "$ref": "#/$defs/ActionLimits"
        },
        "auth": {
          "$ref": "#/$defs/AuthLimits"
        },
        "integration": {
          "$ref": "#/$defs/IntegrationLimits"
        },
        "monitor": {
          "$ref": "#/$defs/MonitorLimits"
        },
        "storage": {
          "$ref": "#/$defs/StorageLimits"
        },
        "template": {
          "$ref": "#/$defs/TemplateLimits"
        }
      },
      "required": [
        "app_domains",
        "privileged_domains",
        "max_default_timeout",
        "proxy",
        "middleware",
        "action",
        "auth",
        "integration",
        "monitor",
        "storage",
        "template"
      ]
    },
    "ProxyLimits": {
      "type": "object",
      "properties": {
        "count": {
          "description": "max number of proxies per application.",
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "disallowed_targets": {
          "description": "a list of any internal or external target\nregexes that should be disallowed.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "count",
        "disallowed_targets"
      ]
    },
    "MiddlewareLimits": {
      "type": "object",
      "properties": {
        "count": {
          "description": "max number of proxies per application.",
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535
        },
        "disallowed_endpoints": {
          "description": "a list of any internal or external target\nregexes that should be disallowed.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "count",
        "disallowed_endpoints"
      ]
    },
    "ActionLimits": {
      "type": "object",
      "properties": {
        "count": {
          "description": "Max number of actions per app.",
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_timeout": {
          "description": "Action request timeout.\n\nUnit: seconds.",
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535
        }
      },
      "required": [
        "count",
        "max_timeout"
      ]
    },
    "AuthLimits": {
      "type": "object"
    },
    "IntegrationLimits": {
      "type": "object",
      "properties": {
        "count": {
          "description": "Max number of integrations per app.",
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_timeout": {
          "description": "Integration request timeout.\n\nUnit: seconds.",
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535
        }
      },
      "required": [
        "count",
        "max_timeout"
      ]
    },
    "MonitorLimits": {
      "type": "object"
    },
    "StorageLimits": {
      "type": "object",
      "properties": {
        "max_storage": {
          "description": "Maximum total storage for all apps and api.\n\nUnit: bytes.\n\nDefault: 10 GB",
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_app_storage": {
          "description": "Maximum per-app storage.\n\nUnit: bytes.\n\nDefault: 50 MB",
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "assets": {
          "$ref": "#/$defs/AssetsLimits"
        },
        "artifact": {
          "$ref": "#/$defs/ArtifactLimits"
        },
        "cache": {
          "$ref": "#/$defs/CacheLimits"
        },
        "content": {
          "$ref": "#/$defs/ContentLimits"
        },
        "model": {
          "$ref": "#/$defs/ModelLimits"
        },
        "secrets": {
          "$ref": "#/$defs/SecretsLimits"
        }
      },
      "required": [
        "max_storage",
        "max_app_storage",
        "assets",
        "artifact",
        "cache",
        "content",
        "model",
        "secrets"
      ]
    },
    "AssetsLimits": {
      "type": "object",
      "properties": {
        "allowed_extensions": {
          "description": "Allowed extensions corresponding to\n[MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types) types.\n\n(More to be supported in the future)\n\nSupported:\n- \"txt\"\n- \"xml\"\n- \"html\"\n- \"css\"\n- \"css.map\"\n- \"csv\"\n- \"js\"\n- \"png\"\n- \"apng\"\n- \"gif\"\n- \"svg\"\n- \"jpg\"\n- \"jpeg\"\n- \"bmp\"\n- \"tif\"\n- \"tiff\"\n- \"webp\"\n- \"avif\"\n- \"ico\"\n- \"pdf\"\n- \"json\"\n- \"wasm\"\n\nSpecial:\n- \"none\" (for no extension; uses \"application/octet-stream\")\n- \"any\" (for unsupported extensions; also uses \"application/octet-stream\")",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "max_store_size": {
          "description": "Limit on total storage for all assets within an app\n(bytes).",
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_asset_size": {
          "description": "Limit on individual asset size (bytes).",
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "allowed_extensions",
        "max_store_size",
        "max_asset_size"
      ]
    },
    "ArtifactLimits": {
      "type": "object",
      "properties": {
        "max_store_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_artifact_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "max_store_size",
        "max_artifact_size"
      ]
    },
    "CacheLimits": {
      "type": "object",
      "properties": {
        "max_size_range": {
          "type": "array",
          "prefixItems": [
            {
              "type": "integer",
              "format": "uint64",
              "minimum": 0
            },
            {
              "type": "integer",
              "format": "uint64",
              "minimum": 0
            }
          ],
          "minItems": 2,
          "maxItems": 2
        },
        "max_count_range": {
          "type": "array",
          "prefixItems": [
            {
              "type": "integer",
              "format": "uint",
              "minimum": 0
            },
            {
              "type": "integer",
              "format": "uint",
              "minimum": 0
            }
          ],
          "minItems": 2,
          "maxItems": 2
        },
        "clean_interval_ranges": {
          "type": "array",
          "prefixItems": [
            {
              "type": "array",
              "prefixItems": [
                {
                  "type": "integer",
                  "format": "uint64",
                  "minimum": 0
                },
                {
                  "type": "integer",
                  "format": "uint64",
                  "minimum": 0
                }
              ],
              "minItems": 2,
              "maxItems": 2
            },
            {
              "type": "array",
              "prefixItems": [
                {
                  "type": "integer",
                  "format": "uint64",
                  "minimum": 0
                },
                {
                  "type": "integer",
                  "format": "uint64",
                  "minimum": 0
                }
              ],
              "minItems": 2,
              "maxItems": 2
            }
          ],
          "minItems": 2,
          "maxItems": 2
        }
      },
      "required": [
        "max_size_range",
        "max_count_range",
        "clean_interval_ranges"
      ]
    },
    "ContentLimits": {
      "type": "object",
      "properties": {
        "search_enabled": {
          "type": "boolean"
        },
        "max_content_definitions": {
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_content_fields": {
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_store_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_object_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_field_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "search_enabled",
        "max_content_definitions",
        "max_content_fields",
        "max_store_size",
        "max_object_size",
        "max_field_size"
      ]
    },
    "ModelLimits": {
      "type": "object",
      "properties": {
        "search_enabled": {
          "type": "boolean"
        },
        "max_model_definitions": {
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_model_fields": {
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_item_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "max_field_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "search_enabled",
        "max_model_definitions",
        "max_model_fields",
        "max_item_size",
        "max_field_size"
      ]
    },
    "SecretsLimits": {
      "type": "object",
      "properties": {
        "max_count": {
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_size": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "max_count",
        "max_size"
      ]
    },
    "TemplateLimits": {
      "type": "object",
      "properties": {
        "count": {
          "description": "Max number of templates per app.",
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "max_timeout": {
          "description": "Template request timeout.\n\nUnit: seconds.",
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535
        }
      },
      "required": [
        "count",
        "max_timeout"
      ]
    },
    "ProxiedMetric": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "endpoint": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "endpoint"
      ]
    }
  }
}