Configuration reference¶
- pydantic settings squarebot.config.Configuration¶
Configuration for Squarebot.
- Parameters:
Show JSON schema
{ "title": "Configuration", "description": "Configuration for Squarebot.", "type": "object", "properties": { "name": { "default": "squarebot", "title": "Name of application", "type": "string" }, "profile": { "allOf": [ { "$ref": "#/$defs/Profile" } ], "default": "production", "title": "Application logging profile" }, "log_level": { "allOf": [ { "$ref": "#/$defs/LogLevel" } ], "default": "INFO", "title": "Log level of the application's logger" }, "path_prefix": { "default": "/squarebot", "description": "The URL prefix where the application's externally-accessible endpoints are hosted.", "title": "API URL path prefix", "type": "string" }, "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." }, "SQUAREBOT_TOPIC_APP_MENTION": { "default": "squarebot.app_mention", "description": "Kafka topic name for `app_mention` Slack events.", "title": "app_mention Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_MESSAGE_CHANNELS": { "default": "squarebot.message.channels", "description": "Kafka topic name for `message.channels` Slack events (messages in public channels).", "title": "message.channels Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_MESSAGE_IM": { "default": "squarebot.message.im", "description": "Kafka topic name for `message.im` Slack events (direct message channels).", "title": "message.im Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_MESSAGE_GROUPS": { "default": "squarebot.message.groups", "description": "Kafka topic name for `message.groups` Slack events (messages in private channels).", "title": "message.groups Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_MESSAGE_MPIM": { "default": "squarebot.message.mpim", "description": "Kafka topic name for `message.mpim` Slack events (messages in multi-person direct messages).", "title": "message.mpim Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_BLOCK_ACTIONS": { "default": "squarebot.interaction.block_actions", "description": "Kafka topic name for `interaction` Slack events of type `block_actions`.", "title": "Block Actions interaction Kafka topic", "type": "string" }, "SQUAREBOT_TOPIC_VIEW_SUBMISSION": { "default": "squarebot.interaction.view_submission", "description": "Kafka topic name for `interaction` Slack events of type `view_submission`.", "title": "View Submission interaction Kafka topic", "type": "string" }, "SQUAREBOT_SLACK_SIGNING": { "format": "password", "title": "Slack signing secret", "type": "string", "writeOnly": true }, "slack_token": { "format": "password", "title": "Slack bot token", "type": "string", "writeOnly": true }, "slack_app_id": { "title": "Slack app ID", "type": "string" } }, "$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": [ "environment_url", "SQUAREBOT_SLACK_SIGNING", "slack_token", "slack_app_id" ] }
- Config:
env_prefix: str = SQUAREBOT_
- Fields:
- field app_mention_topic: str = 'squarebot.app_mention' (alias 'SQUAREBOT_TOPIC_APP_MENTION')¶
Kafka topic name for
app_mention
Slack events.
- field block_actions_topic: str = 'squarebot.interaction.block_actions' (alias 'SQUAREBOT_TOPIC_BLOCK_ACTIONS')¶
Kafka topic name for
interaction
Slack events of typeblock_actions
.
- field environment_url: AnyHttpUrl [Required]¶
The base URL of the environment where the application is hosted.
- Constraints:
allowed_schemes = [‘http’, ‘https’]
- field kafka: KafkaConnectionSettings [Optional]¶
Kafka connection configuration.
- field log_level: LogLevel = LogLevel.INFO¶
- field message_channels_topic: str = 'squarebot.message.channels' (alias 'SQUAREBOT_TOPIC_MESSAGE_CHANNELS')¶
Kafka topic name for
message.channels
Slack events (messages in public channels).
- field message_groups_topic: str = 'squarebot.message.groups' (alias 'SQUAREBOT_TOPIC_MESSAGE_GROUPS')¶
Kafka topic name for
message.groups
Slack events (messages in private channels).
- field message_im_topic: str = 'squarebot.message.im' (alias 'SQUAREBOT_TOPIC_MESSAGE_IM')¶
Kafka topic name for
message.im
Slack events (direct message channels).
- field message_mpim_topic: str = 'squarebot.message.mpim' (alias 'SQUAREBOT_TOPIC_MESSAGE_MPIM')¶
Kafka topic name for
message.mpim
Slack events (messages in multi-person direct messages).
- field name: str = 'squarebot'¶
- field path_prefix: str = '/squarebot'¶
The URL prefix where the application’s externally-accessible endpoints are hosted.
- field profile: Profile = Profile.production¶
- field slack_app_id: str [Required]¶
- field slack_signing_secret: SecretStr [Required] (alias 'SQUAREBOT_SLACK_SIGNING')¶
- field slack_token: SecretStr [Required]¶
- field view_submission_topic: str = 'squarebot.interaction.view_submission' (alias 'SQUAREBOT_TOPIC_VIEW_SUBMISSION')¶
Kafka topic name for
interaction
Slack events of typeview_submission
.
- pydantic settings squarebot.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.
- class squarebot.config.KafkaSecurityProtocol(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Kafka security protocols understood by aiokafka.
- class squarebot.config.KafkaSaslMechanism(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Kafka SASL mechanisms understood by aiokafka.