Configuration Reference
PyLocket is configured through environment variables. This reference covers all configuration options available to developers using the PyLocket platform.
Client Configuration
CLI Credentials
| File |
Path |
Description |
| Credentials |
~/.pylocket/credentials |
Stored auth tokens (auto-managed by pylocket login) |
Environment Variables
| Variable |
Description |
Default |
PYLOCKET_TOKEN |
API authentication token |
— |
PYLOCKET_API_URL |
API base URL |
https://api.pylocket.com |
Application-Level Configuration
These settings are configured per-app through the CLI, API, or Developer Portal.
Protection Settings
| Setting |
CLI Flag |
API Field |
Description |
Default |
| Target platform |
--platform |
platform |
OS + architecture |
(required) |
| Python version |
--python |
python_version |
Bytecode version |
(required) |
Every build receives maximum protection automatically. No protection level configuration is needed.
Licensing Settings
| Setting |
CLI Flag |
API Field |
Description |
Default |
| Device limit |
--device-limit |
device_limit |
Max devices per license |
2 |
| Offline grace |
--offline-grace-hours |
offline_grace_hours |
Hours of offline use after activation |
72 |
| License expiration |
--expires |
expires_at |
License expiry date |
None (perpetual) |
| License type |
--type |
license_type |
standard or demo |
standard |
Backend Configuration (Self-Hosted)
If you are running a self-hosted PyLocket instance, the backend is configured through environment variables loaded by Pydantic Settings.
Configuration Loading Order
- Environment variables (highest priority)
.env file in the project root
- Default values in
backend/config/settings.py
Environment variables always override .env file values.
Core Settings
| Variable |
Description |
Default |
Required |
ENV |
Environment name |
development |
No |
DEBUG |
Enable debug mode |
true |
No |
API_BASE_URL |
Public API URL |
http://localhost:8000 |
Yes (production) |
Database
| Variable |
Description |
Default |
DATABASE_URL |
Database connection string |
sqlite+aiosqlite:///./pylocket.db |
Supported databases:
- SQLite: sqlite+aiosqlite:///./pylocket.db (development)
- PostgreSQL: postgresql+asyncpg://user:pass@host:5432/pylocket (production)
Redis
| Variable |
Description |
Default |
REDIS_URL |
Redis connection string |
redis://localhost:6379/0 |
AWS
| Variable |
Description |
Default |
AWS_REGION |
AWS region |
us-east-1 |
AWS_ACCESS_KEY_ID |
IAM access key |
— |
AWS_SECRET_ACCESS_KEY |
IAM secret key |
— |
S3_ARTIFACT_BUCKET |
Upload bucket name |
pylocket-uploads |
S3_PROTECTED_BUCKET |
Protected output bucket |
pylocket-artifacts |
CLOUDFRONT_DISTRIBUTION_ID |
CDN distribution ID |
— |
CLOUDFRONT_KEY_PAIR_ID |
CloudFront signing key ID |
— |
CLOUDFRONT_PRIVATE_KEY_PATH |
Path to CloudFront PEM key |
— |
Stripe
| Variable |
Description |
Default |
STRIPE_SECRET_KEY |
Stripe secret API key |
— |
STRIPE_PUBLISHABLE_KEY |
Stripe publishable key |
— |
STRIPE_WEBHOOK_SECRET |
Webhook signing secret |
— |
Email (AWS SES)
| Variable |
Description |
Default |
SES_SENDER_EMAIL |
Verified sender email |
— |
SES_ENABLED |
Enable email sending |
false |
Anti-Virus
| Variable |
Description |
Default |
VIRUSTOTAL_API_KEY |
VirusTotal API key |
— |
VIRUSTOTAL_ENABLED |
Enable malware scanning |
false |
VIRUSTOTAL_THRESHOLD |
Min vendor detections to flag |
3 |
Billing
| Variable |
Description |
Default |
FREE_DOWNLOAD_LIMIT |
Free downloads per app |
10 |
BASE_FEE_CENTS |
Annual base fee (cents) |
900 |
LICENSE_FEE_CENTS |
Per-license fee (cents) |
400 |
STORAGE_PROFIT_MARGIN |
Margin on storage costs |
0.15 |
Token Lifetimes
| Variable |
Description |
Default |
ACCESS_TOKEN_EXPIRE_MINUTES |
Access token TTL |
60 |
REFRESH_TOKEN_EXPIRE_DAYS |
Refresh token TTL |
30 |
RUNTIME_TOKEN_EXPIRE_HOURS |
Runtime token TTL |
24 |
DOWNLOAD_TOKEN_EXPIRE_MINUTES |
Signed download URL TTL |
10080 (7 days) |
Telemetry
| Variable |
Description |
Default |
TELEMETRY_ENABLED |
Enable usage telemetry |
true |
TELEMETRY_RETENTION_DAYS |
Days to retain telemetry data |
90 |
CORS
| Variable |
Description |
Default |
CORS_ORIGINS |
Comma-separated allowed origins |
http://localhost:3000,http://localhost:3001 |
.env File Template
A complete .env.example template is included in the project root. Copy it to create your local configuration:
Edit .env with your credentials and settings. The file is git-ignored and should never be committed.
See Also