Configuration reference¶
- pydantic settings ook.config.Configuration¶
Configuration for ook.
- Parameters:
_nested_model_default_partial_update (
bool
|None
, default:None
)_env_file (
Union
[Path
,str
,Sequence
[Union
[Path
,str
]],None
], default:PosixPath('.')
)_cli_parse_args (
bool
|list
[str
] |tuple
[str
,...
] |None
, default:None
)_cli_settings_source (
Optional
[CliSettingsSource
[object
]], default:None
)_secrets_dir (
Union
[Path
,str
,Sequence
[Union
[Path
,str
]],None
], default:None
)values (
Any
)
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": { "$ref": "#/$defs/Profile", "default": "production", "description": "Application logging profile: 'development' or 'production'." }, "SAFIR_LOG_LEVEL": { "$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": { "$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.\n\nThis settings model supports different authentication methods, which each\nhave different sets of required settings. All of these settings can be\nprovided in ``KAFKA_`` prefixed environment variables. Instances of this\nmodel have properties that can be used to construct different types of\nkafka clients:\n\n.. code-block:: python\n\n from faststream.broker import KafkaBroker\n\n from safir.kafka import KafkaConnectionSettings\n\n\n config = KafkaConnectionSettings()\n kafka_broker = KafkaBroker(**config.faststream_broker_params)\n\nWhen using this model directly, The ``validated`` property enforces at\nruntime that the correct settings were provided for the desired\nauthentication method, and returns models to access those settings in a\ntype-safe way:\n\n.. code-block:: python\n\n from pathlib import Path\n\n\n # ValidationError at runtime: ``client_key_path`` is not provided\n config = KafkaConnectionSettings(\n bootstrap_servers=\"something:1234\",\n security_protocol=KafkaSecurityProtocol.SSL,\n cluster_ca_path=Path(\"/some/cert.crt\"),\n client_cert_path=Path(\"/some/other/cert.crt\"),\n )\n\n config = KafkaConnectionSettings(\n bootstrap_servers=\"something:1234\",\n security_protocol=KafkaSecurityProtocol.SSL,\n cluster_ca_path=Path(\"/some/path/ca.crt\"),\n client_cert_path=Path(\"/some/path/user.crt\"),\n client_key_path=Path(\"/some/path/user.key\"),\n )\n\n blah = config.validated.sasl_username # Static type error", "properties": { "bootstrapServers": { "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.", "examples": [ "kafka-1:9092,kafka-2:9092,kafka-3:9092", "kafka:9092" ], "title": "Kafka bootstrap servers", "type": "string" }, "securityProtocol": { "$ref": "#/$defs/SecurityProtocol", "description": "The authentication and encryption mode for the connection.", "title": "Security Protocol" }, "clusterCaPath": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the PEM-formatted CA certificate file to use for verifying the broker's certificate. This is only needed for SSL and SASL_SSL security protocols, andeven in those cases, only when the broker's certificate is not signed by a CA trusted by the operating system.", "examples": [ "/some/dir/ca.crt" ], "title": "Path to CA certificate file" }, "clientCertPath": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the PEM-formated client certificate file to use for authentication. This is only needed if the broker is configured to require SSL client authentication.", "examples": [ "/some/dir/user.crt" ], "title": "Path to client certificate file" }, "clientKeyPath": { "anyOf": [ { "format": "file-path", "type": "string" }, { "type": "null" } ], "default": null, "description": "The path to the PEM-formatted client key file to use for authentication. This is only needed if for the SSL securityprotocol.", "examples": [ "/some/dir/user.key" ], "title": "Path to client key file" }, "saslMechanism": { "anyOf": [ { "$ref": "#/$defs/SaslMechanism" }, { "type": "null" } ], "default": null, "description": "The SASL mechanism to use for authentication. This is only needed for the SASL_SSL and SASL_PLAINTEXT securityprotocols.", "title": "SASL mechanism" }, "saslUsername": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The username to use for SASL authentication. This is only needed for the SASL_SSL and SASL_PLAINTEXT securityprotocols.", "title": "SASL username" }, "saslPassword": { "anyOf": [ { "format": "password", "type": "string", "writeOnly": true }, { "type": "null" } ], "default": null, "description": "The password to use for SASL authentication. This is only needed for the SASL_SSL and SASL_PLAINTEXT securityprotocols.", "title": "SASL password" } }, "required": [ "bootstrapServers", "securityProtocol" ], "title": "KafkaConnectionSettings", "type": "object" }, "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" }, "SaslMechanism": { "description": "Kafka SASL mechanisms.", "enum": [ "PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512" ], "title": "SaslMechanism", "type": "string" }, "SecurityProtocol": { "description": "Kafka SASL security protocols.", "enum": [ "SASL_PLAINTEXT", "SASL_SSL", "PLAINTEXT", "SSL" ], "title": "SecurityProtocol", "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.
- 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.