Configuration reference¶
- pydantic settings ook.config.Configuration¶
Configuration for ook.
- Parameters:
Show JSON schema
{ "title": "Configuration", "description": "Configuration for ook.", "type": "object", "properties": { "SAFIR_NAME": { "default": "ook", "description": "The application's name", "title": "Safir Name", "type": "string" }, "SAFIR_PROFILE": { "allOf": [ { "$ref": "#/$defs/Profile" } ], "default": "production", "description": "Application logging profile: 'development' or 'production'." }, "SAFIR_LOG_LEVEL": { "allOf": [ { "$ref": "#/$defs/LogLevel" } ], "default": "INFO", "title": "Log level of the application's logger" }, "SAFIR_PATH_PREFIX": { "default": "/ook", "description": "The URL prefix where the application's externally-accessible endpoints are hosted.", "title": "API URL path prefix", "type": "string" }, "SAFIR_ENVIRONMENT_URL": { "description": "The base URL of the environment where the application is hosted.", "format": "uri", "minLength": 1, "title": "Base URL of the environment", "type": "string" }, "kafka": { "allOf": [ { "$ref": "#/$defs/KafkaConnectionSettings" } ], "description": "Kafka connection configuration." }, "OOK_ENABLE_CONSUMER": { "default": true, "description": "Enable Kafka consumer.", "title": "Ook Enable Consumer", "type": "boolean" }, "OOK_INGEST_KAFKA_TOPIC": { "default": "ook.ingest", "description": "The name of the Kafka topic for the ingest queue.", "title": "Ook Ingest Kafka Topic", "type": "string" }, "OOK_GROUP_ID": { "default": "ook", "description": "Kafka consumer group ID.", "title": "Ook Group Id", "type": "string" }, "ALGOLIA_APP_ID": { "description": "The Algolia app ID", "title": "Algolia App Id", "type": "string" }, "ALGOLIA_API_KEY": { "description": "The Algolia API key", "format": "password", "title": "Algolia Api Key", "type": "string", "writeOnly": true }, "ALGOLIA_DOCUMENT_INDEX": { "default": "document_dev", "description": "Name of the Algolia document index", "title": "Algolia Document Index", "type": "string" }, "OOK_GITHUB_APP_ID": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Ook Github App Id" }, "OOK_GITHUB_APP_PRIVATE_KEY": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "title": "Ook Github App Private Key" } }, "$defs": { "KafkaConnectionSettings": { "additionalProperties": false, "description": "Settings for connecting to Kafka.", "properties": { "bootstrap_servers": { "description": "A comma-separated list of Kafka brokers to connect to. This should be a list of hostnames or IP addresses, each optionally followed by a port number, separated by commas. For example: ``kafka-1:9092,kafka-2:9092,kafka-3:9092``.", "title": "Kafka bootstrap servers", "type": "string" }, "security_protocol": { "allOf": [ { "$ref": "#/$defs/KafkaSecurityProtocol" } ], "default": "PLAINTEXT", "description": "The security protocol to use when connecting to Kafka." }, "cert_temp_dir": { "anyOf": [ { "format": "directory-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Temporary writable directory for concatenating certificates.", "title": "Cert Temp Dir" }, "cluster_ca_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the CA certificate file to use for verifying the broker's certificate. This is only needed if the broker's certificate is not signed by a CA trusted by the operating system.", "title": "Path to CA certificate file" }, "client_ca_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client CA certificate file to use for authentication. This is only needed when the client certificate needs to beconcatenated with the client CA certificate, which is commonfor Strimzi installations.", "title": "Path to client CA certificate file" }, "client_cert_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client certificate file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.", "title": "Path to client certificate file" }, "client_key_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client key file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.", "title": "Path to client key file" }, "client_key_password": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "description": "The password to use for decrypting the client key file. This is only needed if the client key file is encrypted.", "title": "Password for client key file" }, "sasl_mechanism": { "anyOf": [ { "$ref": "#/$defs/KafkaSaslMechanism" }, { "type": "null" } ], "default": "PLAIN", "description": "The SASL mechanism to use for authentication. This is only needed if SASL authentication is enabled.", "title": "SASL mechanism" }, "sasl_username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The username to use for SASL authentication. This is only needed if SASL authentication is enabled.", "title": "SASL username" }, "sasl_password": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "description": "The password to use for SASL authentication. This is only needed if SASL authentication is enabled.", "title": "SASL password" } }, "required": [ "bootstrap_servers" ], "title": "KafkaConnectionSettings", "type": "object" }, "KafkaSaslMechanism": { "description": "Kafka SASL mechanisms understood by aiokafka.", "enum": [ "PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512" ], "title": "KafkaSaslMechanism", "type": "string" }, "KafkaSecurityProtocol": { "description": "Kafka security protocols understood by aiokafka.", "enum": [ "PLAINTEXT", "SSL" ], "title": "KafkaSecurityProtocol", "type": "string" }, "LogLevel": { "description": "Python logging level.\n\nAny case variation is accepted when converting a string to an enum value\nvia the class constructor.", "enum": [ "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" ], "title": "LogLevel", "type": "string" }, "Profile": { "description": "Logging profile for the application.", "enum": [ "production", "development" ], "title": "Profile", "type": "string" } }, "additionalProperties": false, "required": [ "SAFIR_ENVIRONMENT_URL", "ALGOLIA_APP_ID", "ALGOLIA_API_KEY" ] }
- Fields:
- Validators:
- field algolia_api_key: SecretStr [Required]¶
The Algolia API key
- field algolia_app_id: str [Required]¶
The Algolia app ID
- field algolia_document_index_name: str = 'document_dev'¶
Name of the Algolia document index
- field enable_kafka_consumer: bool = True¶
Enable Kafka consumer.
- field environment_url: AnyHttpUrl [Required]¶
The base URL of the environment where the application is hosted.
- Constraints:
allowed_schemes = [‘http’, ‘https’]
- field github_app_id: int | None = None¶
The GitHub App ID, as determined by GitHub when setting up a GitHub App.
- field github_app_private_key: SecretStr | None = None¶
The GitHub app private key. See https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/managing-private-keys-for-github-apps
- Validated by:
- field ingest_kafka_topic: str = 'ook.ingest'¶
The name of the Kafka topic for the ingest queue.
- field kafka: KafkaConnectionSettings [Optional]¶
Kafka connection configuration.
- field kafka_consumer_group_id: str = 'ook'¶
Kafka consumer group ID.
- field log_level: LogLevel = LogLevel.INFO¶
- field name: str = 'ook'¶
The application’s name
- field path_prefix: str = '/ook'¶
The URL prefix where the application’s externally-accessible endpoints are hosted.
- field profile: Profile = Profile.production¶
Application logging profile: ‘development’ or ‘production’.
- validator validate_none_secret » github_app_private_key¶
Validate a SecretStr setting which may be “None” that is intended to be
None
.This is useful for secrets generated from 1Password or environment variables where the value cannot be null.
- pydantic settings ook.config.KafkaConnectionSettings¶
Settings for connecting to Kafka.
- Parameters:
Show JSON schema
{ "title": "KafkaConnectionSettings", "description": "Settings for connecting to Kafka.", "type": "object", "properties": { "bootstrap_servers": { "description": "A comma-separated list of Kafka brokers to connect to. This should be a list of hostnames or IP addresses, each optionally followed by a port number, separated by commas. For example: ``kafka-1:9092,kafka-2:9092,kafka-3:9092``.", "title": "Kafka bootstrap servers", "type": "string" }, "security_protocol": { "allOf": [ { "$ref": "#/$defs/KafkaSecurityProtocol" } ], "default": "PLAINTEXT", "description": "The security protocol to use when connecting to Kafka." }, "cert_temp_dir": { "anyOf": [ { "format": "directory-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "Temporary writable directory for concatenating certificates.", "title": "Cert Temp Dir" }, "cluster_ca_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the CA certificate file to use for verifying the broker's certificate. This is only needed if the broker's certificate is not signed by a CA trusted by the operating system.", "title": "Path to CA certificate file" }, "client_ca_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client CA certificate file to use for authentication. This is only needed when the client certificate needs to beconcatenated with the client CA certificate, which is commonfor Strimzi installations.", "title": "Path to client CA certificate file" }, "client_cert_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client certificate file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.", "title": "Path to client certificate file" }, "client_key_path": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the client key file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.", "title": "Path to client key file" }, "client_key_password": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "description": "The password to use for decrypting the client key file. This is only needed if the client key file is encrypted.", "title": "Password for client key file" }, "sasl_mechanism": { "anyOf": [ { "$ref": "#/$defs/KafkaSaslMechanism" }, { "type": "null" } ], "default": "PLAIN", "description": "The SASL mechanism to use for authentication. This is only needed if SASL authentication is enabled.", "title": "SASL mechanism" }, "sasl_username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The username to use for SASL authentication. This is only needed if SASL authentication is enabled.", "title": "SASL username" }, "sasl_password": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "description": "The password to use for SASL authentication. This is only needed if SASL authentication is enabled.", "title": "SASL password" } }, "$defs": { "KafkaSaslMechanism": { "description": "Kafka SASL mechanisms understood by aiokafka.", "enum": [ "PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512" ], "title": "KafkaSaslMechanism", "type": "string" }, "KafkaSecurityProtocol": { "description": "Kafka security protocols understood by aiokafka.", "enum": [ "PLAINTEXT", "SSL" ], "title": "KafkaSecurityProtocol", "type": "string" } }, "additionalProperties": false, "required": [ "bootstrap_servers" ] }
- Config:
env_prefix: str = KAFKA_
- Fields:
- field bootstrap_servers: str [Required]¶
A comma-separated list of Kafka brokers to connect to. This should be a list of hostnames or IP addresses, each optionally followed by a port number, separated by commas. For example:
kafka-1:9092,kafka-2:9092,kafka-3:9092
.
- field cert_temp_dir: DirectoryPath | None = None¶
Temporary writable directory for concatenating certificates.
- field client_ca_path: FilePath | None = None¶
The path to the client CA certificate file to use for authentication. This is only needed when the client certificate needs to beconcatenated with the client CA certificate, which is commonfor Strimzi installations.
- field client_cert_path: FilePath | None = None¶
The path to the client certificate file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.
- field client_key_password: SecretStr | None = None¶
The password to use for decrypting the client key file. This is only needed if the client key file is encrypted.
- field client_key_path: FilePath | None = None¶
The path to the client key file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.
- field cluster_ca_path: FilePath | None = None¶
The path to the CA certificate file to use for verifying the broker’s certificate. This is only needed if the broker’s certificate is not signed by a CA trusted by the operating system.
- field sasl_mechanism: KafkaSaslMechanism | None = KafkaSaslMechanism.PLAIN¶
The SASL mechanism to use for authentication. This is only needed if SASL authentication is enabled.
- field sasl_password: SecretStr | None = None¶
The password to use for SASL authentication. This is only needed if SASL authentication is enabled.
- field sasl_username: str | None = None¶
The username to use for SASL authentication. This is only needed if SASL authentication is enabled.
- field security_protocol: KafkaSecurityProtocol = KafkaSecurityProtocol.PLAINTEXT¶
The security protocol to use when connecting to Kafka.
- property ssl_context: SSLContext | None¶
An SSL context for connecting to Kafka with aiokafka, if the Kafka connection is configured to use SSL.