Add static API-key auth, dockerize service, publish façade docs
- sms/auth.py: verify_api_key dependency (Bearer/X-API-Key, SHA-256 hash compare via secrets.compare_digest, fail-closed 503 if no hash). All routes gated via a protected router; /health stays open for probes. - config.py: new sms_api_key_hash setting (VOIPMS_SMS_API_KEY_HASH). - Dockerfile + .dockerignore + docker-compose.yml: lean python:3.13-slim image; secrets injected via env_file, never baked in; host-localhost-only port mapping (SMS_PORT override); /health healthcheck. - .env.example: committed template (placeholders only, no secrets). - sms/docs/sms-facade.dokuwiki.txt: abstraction API reference (published to the apidoc wiki at voipms:sms-facade). - README: Authentication section, Docker section, 401/503 error rows. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
14
.env.example
Normal file
14
.env.example
Normal file
@@ -0,0 +1,14 @@
|
||||
# Template — copy to .env (chmod 600, gitignored) and fill in real values.
|
||||
# Used by sms/config.py (Settings, env_prefix=voipms_).
|
||||
|
||||
# voip.ms REST API credentials (portal login email + API password from API Security)
|
||||
VOIPMS_API_USERNAME=you@example.com
|
||||
VOIPMS_API_PASSWORD=your-api-password
|
||||
|
||||
# SHA-256 hash of the accepted client API key (raw key is NOT stored here).
|
||||
# Generate: python3 -c "import secrets,hashlib; k=secrets.token_urlsafe(32); print('KEY:',k); print('HASH:',hashlib.sha256(k.encode()).hexdigest())"
|
||||
VOIPMS_SMS_API_KEY_HASH=
|
||||
|
||||
# Optional overrides
|
||||
VOIPMS_DIALING_MODE=nanpa
|
||||
VOIPMS_DAILY_LIMIT=100
|
||||
Reference in New Issue
Block a user