Overview
The server configuration file (server.yml) controls all runtime settings for Permission Mongo including HTTP server options, database connections, authentication, audit logging, caching, versioning, and scalability limits.
Configuration File Structure
Server Options
Configure the HTTP server host, port, and timeout settings.The hostname or IP address to bind the HTTP server to. Use
0.0.0.0 to listen on all interfaces.Environment variable: ${ENV.SERVER_HOST}The port number for the HTTP server. Must be between 1-65535.Environment variable:
${ENV.SERVER_PORT}Maximum duration for reading the entire request, including the body. Supports duration strings like
30s, 1m, 1h.Maximum duration before timing out writes of the response. Supports duration strings like
30s, 1m, 1h.Example
MongoDB Configuration
Configure MongoDB connection settings and connection pool parameters.MongoDB connection URI. Supports all standard MongoDB URI formats including authentication, replica sets, and connection options.Environment variable:
${ENV.MONGODB_URI}Example: mongodb://username:password@localhost:27017The name of the MongoDB database to use for Permission Mongo collections.Environment variable:
${ENV.MONGODB_DATABASE}Maximum number of connections in the MongoDB connection pool.
Minimum number of connections to maintain in the MongoDB connection pool.
Example
Environment Variables
Redis Configuration
Configure Redis connection for caching policies, hierarchies, and schemas.Redis server URL in the format
host:port or full Redis URI.Environment variable: ${ENV.REDIS_URL}Password for Redis authentication. Leave empty if no authentication is required.Environment variable:
${ENV.REDIS_PASSWORD}Redis database number (0-15).
Number of connections in the Redis connection pool.
Example
Authentication Configuration
Configure JWT authentication settings for API access.JWT signing algorithm. Supported values:
RS256, RS384, RS512, HS256, HS384, HS512.Path to the public key file for RSA algorithms (RS256/RS384/RS512). Required when using RSA algorithms.
Expected JWT issuer claim. Tokens with a different issuer will be rejected.
Example
Audit Configuration
Configure audit logging for all operations. Audit logs track create, read, update, and delete operations.Whether to log read operations. Can generate high volume in read-heavy workloads.
Whether to log write operations (create, update, delete).
Whether to log failed operations (permission denied, validation errors).
Include before/after document snapshots in audit logs for update operations.
MongoDB Storage
Store audit logs in MongoDB.
MongoDB collection name for storing audit logs.
Number of days to retain audit logs before automatic deletion via TTL index.
Webhook Storage
Send audit logs to an external webhook URL.
Webhook URL to send audit logs to. Required when webhook is enabled.Environment variable:
${ENV.AUDIT_WEBHOOK_URL}Custom HTTP headers to include in webhook requests.
Number of audit log entries to batch before sending to webhook.
Maximum time in seconds to wait before flushing batched audit logs.
Example
Cache Configuration
Configure TTL (time-to-live) for different cache types. Permission Mongo caches policies, hierarchies, and schemas in Redis.TTL in seconds for cached policy configurations.
TTL in seconds for cached user hierarchy data.
TTL in seconds for cached schema configurations.
Example
Versioning Configuration
Configure document version cleanup and archival settings.Interval in hours between version cleanup operations that remove old versions.
Enable archiving old versions to an external system before deletion.
Webhook URL to send archived versions to.
Number of versions to archive in a single batch.
Whether to archive versions before deleting them.
Number of retry attempts for failed archive operations.
Timeout in seconds for archive webhook requests.
Example
Scalability Configuration
Configure resource limits to prevent abuse and ensure system stability.Maximum number of concurrent HTTP requests the server will handle.
Maximum number of documents in a single batch operation.
Maximum number of stages in MongoDB aggregation pipelines.
Maximum number of documents returned in a single query result.
Memory limit in MB for individual query operations.
Example
Complete Example
Environment Variable Substitution
All configuration values support environment variable substitution using the${ENV.VAR_NAME} syntax:
Loading Configuration
The server configuration is loaded at startup from the path specified via command-line flag:PM_CONFIG environment variable: