Files
notifier/config.yaml
T

175 lines
5.5 KiB
YAML

# Notifier Service Configuration
server:
grpc_port: 50051
rest_port: 8080
host: "0.0.0.0"
mode: "both" # Options: both, grpc, rest
queue:
type: "local" # Options: local, kafka
max_size: 10000
worker_count: 10
retry_attempts: 3
retry_backoff: "exponential" # Options: exponential, linear, fixed
# Local queue configuration
local:
buffer_size: 1000
persist_to_disk: false
persist_path: "/var/lib/notifier/queue.json"
# Kafka queue configuration (when type: kafka)
# kafka:
# brokers:
# - "localhost:9092"
# topic: "notifications"
# consumer_group: "notifier-service"
# partition_count: 10
# replication_factor: 3
# enable_idempotence: true
# compression_type: "snappy"
notifiers:
# Enable stdout notifier (useful for development/debugging)
stdout: true
# SMTP email configuration (supports multiple accounts)
smtp:
# Personal email account (marked as default)
personal:
host: "smtp.gmail.com"
port: 587
username: "your-personal@gmail.com"
password: "your-app-password"
from: "your-personal@gmail.com"
use_tls: true
default: true # This account will be used if no account is specified in the API request
# Work email account
# work:
# host: "smtp.company.com"
# port: 587
# username: "you@company.com"
# password: "your-work-password"
# from: "notifications@company.com"
# use_tls: true
# default: false
# Slack configuration (supports multiple workspaces/webhooks)
slack:
# Main workspace (marked as default)
main:
webhook_url: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
username: "Notifier Bot"
icon_emoji: ":bell:"
default: true # This workspace will be used if no account is specified
# Additional workspace example
# team-a:
# webhook_url: "https://hooks.slack.com/services/TEAM-A/WEBHOOK/URL"
# username: "Team A Bot"
# icon_emoji: ":rocket:"
# # Channel-specific webhooks within this workspace
# webhooks:
# "#alerts": "https://hooks.slack.com/services/ALERTS/WEBHOOK"
# "#monitoring": "https://hooks.slack.com/services/MONITORING/WEBHOOK"
# Ntfy configuration (supports multiple servers)
ntfy:
# Public ntfy.sh server (marked as default)
public:
server_url: "https://ntfy.sh"
# token: "tk_your_access_token" # Token-based auth (recommended)
# default_topic: "notifications"
default: true # This server will be used if no account is specified
# Private ntfy server example
# private:
# server_url: "https://ntfy.mycompany.com"
# username: "your-username"
# password: "your-password"
# default_topic: "company-notifications"
# insecure_skip_verify: false # Set to true for self-signed certs
# Authentication and authorization configuration
# auth:
# enabled: false # Enable API key authentication
# default_rate_limit: 100 # Default requests per minute (0 = unlimited)
# bootstrap:
# enabled: false # Enable bootstrap admin key creation on startup
# admin_key_file: "/tmp/notifier-admin-key" # Save generated key to this file
# print_to_stdout: false # Print key to stdout (DANGER: only for setup)
#
# Example with bootstrap enabled for testing:
# auth:
# enabled: true
# default_rate_limit: 100
# database:
# url: "postgresql://user:password@localhost:5432/notifier"
# bootstrap:
# enabled: true
# admin_key_file: "/tmp/notifier-admin-key"
# print_to_stdout: true
logging:
level: "info" # Options: debug, info, warn, error
format: "json" # Options: json, text
output_path: "stdout" # Options: stdout, stderr, or file path
metrics:
enabled: true
port: 9090
path: "/metrics"
prometheus_enabled: true
health_check:
enabled: true
port: 8081
path: "/health"
interval: 30 # seconds
# CORS (Cross-Origin Resource Sharing) configuration
# Controls which web origins can access the REST API
cors:
# Whitelist of allowed origins - wildcards (*) are NOT supported for security
# Development example: Allow localhost on common ports
allowed_origins:
- "http://localhost:3000" # Common React/Next.js dev port
- "http://localhost:8080" # Common Vue/Angular dev port
- "http://localhost:5173" # Vite dev server
# Production example (commented out):
# allowed_origins:
# - "https://app.example.com" # Production web app
# - "https://dashboard.example.com" # Admin dashboard
# - "https://api-docs.example.com" # API documentation site
# Allowed HTTP methods (defaults shown below)
allowed_methods:
- "GET"
- "POST"
- "OPTIONS"
- "DELETE"
# Allowed request headers (defaults shown below)
allowed_headers:
- "Content-Type"
- "Authorization"
# Allow credentials (cookies, authorization headers)
# Set to true if your frontend needs to send auth tokens
allow_credentials: false
# Cache duration for preflight OPTIONS requests (in seconds)
# Browsers will cache the CORS preflight response for this duration
max_age: 3600 # 1 hour
# Notification retention and automatic cleanup configuration
retention:
enabled: true # Enable automatic cleanup of old/expired notifications
ttl: "168h" # Time-to-live: how long to keep notifications (default: 7 days)
check_frequency: "1h" # How often to run cleanup check (default: 1 hour)
max_size: 100000 # Maximum number of notifications to store in memory (default: 100,000)
# When max_size is exceeded, oldest notifications are removed first