All checks were successful
/ pre-commit (push) Successful in 1m47s
Signed-off-by: Julien Riou <julien@riou.xyz>
2.5 KiB
2.5 KiB
collerd
Server to manage notes:
- Website
- API
- Database management
Usage
collerd -help
Configuration
The file format is JSON:
- title (string): Title of the website
- database_type (string): Type of the database (default "sqlite", "postgres" also supported)
- database_dsn (string): Connection string for the database (default "collerd.db")
- id_length (int): Number of characters for note identifiers (default 5)
- password_length (int): Number of characters for generated passwords (default 16)
- expiration_interval (int): Number of seconds to wait between two expiration runs
- listen_address (string): Address to listen for the web server (default "127.0.0.1")
- listen_port (int): Port to listen for the web server (default 8080)
- expirations ([]int): List of supported expiration times in seconds (default 300, 86400, 604800, 18144000)
- expiration (int): Default expiration time in seconds
- max_upload_size (int): Maximum number of bytes received by the server for notes (the base64 encoding may use more space than the real size of the note)
- show_version (bool): Show version on the website
- enable_metrics (bool): Enable Prometheus endpoint (default false)
- prometheus_route (string): Route to expose Prometheus metrics (default "/metrics")
- prometheus_notes_metric (string): Name of the notes count metric (default "collerd_notes")
- observation_internal (int): Number of seconds to wait between two observations (default 60)
The configuration file is not required but the service might not be exposed to the public.
API
GET /health
Returns 200 OK.
POST /api/note
Create a note.
Body (JSON):
- content (string): base64 encoded content (required)
- password (string): user-provided password
- encrypted (bool): true if the note has been encrypted by the client
- expiration (int): lifetime of the note in seconds (must be supported by the server)
- delete_after_read (bool): delete the note after the first read
Response (JSON):
- id (string): ID of the note
GET //
Important
Potential password leak
Return content of a note encrypted by the given password.
GET /
Return content of a note.
If the note is encrypted, the encrypted value is returned (application/octet-stream). Otherwise, the text is returned (text/plain).
Errors
Errors return 500 Server Internal Error with the JSON payload:
- message (string): message of the response
- error (string): error if any