mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-14 18:25:21 +01:00
docs: add environment variables and improve descriptions
This commit is contained in:
30
README.md
30
README.md
@@ -21,18 +21,17 @@ The full API specification can be found in [api/rcond.yaml](api/rcond.yaml).
|
|||||||
All endpoints except `/health` require authentication via an API token passed in the `X-API-Token` header. The token is configured via the `RCOND_API_TOKEN` environment variable when starting the daemon.
|
All endpoints except `/health` require authentication via an API token passed in the `X-API-Token` header. The token is configured via the `RCOND_API_TOKEN` environment variable when starting the daemon.
|
||||||
|
|
||||||
### Endpoints
|
### Endpoints
|
||||||
|
| Method | Path | Description |
|
||||||
| Method | Path | Description |
|
|---------|-------------------------------------|-----------------------------------------|
|
||||||
|--------|------|-------------|
|
| GET | `/health` | Health check endpoint |
|
||||||
| GET | `/health` | Health check endpoint that returns status |
|
| POST | `/network/ap` | Create and activate a WiFi access point |
|
||||||
| POST | `/network/ap` | Create and activate a WiFi access point |
|
| PUT | `/network/interface/{interface}` | Activate a connection |
|
||||||
| PUT | `/network/interface/{interface}` | Activate a connection |
|
| DELETE | `/network/interface/{interface}` | Deactivate a connection |
|
||||||
| DELETE | `/network/interface/{interface}` | Deactivate a connection |
|
| DELETE | `/network/connection/{uuid}` | Remove a connection |
|
||||||
| DELETE | `/network/connection/{uuid}` | Remove a connection |
|
| GET | `/hostname` | Get the hostname |
|
||||||
| GET | `/hostname` | Get the hostname |
|
| POST | `/hostname` | Set the hostname |
|
||||||
| POST | `/hostname` | Set the hostname |
|
| POST | `/users/{user}/keys` | Add an authorized SSH key |
|
||||||
| POST | `/users/{user}/keys` | Add an authorized SSH key |
|
| DELETE | `/users/{user}/keys/{fingerprint}` | Remove an authorized SSH key |
|
||||||
| DELETE | `/users/{user}/keys/{fingerprint}` | Remove an authorized SSH key |
|
|
||||||
|
|
||||||
### Response Codes
|
### Response Codes
|
||||||
|
|
||||||
@@ -43,3 +42,10 @@ All endpoints except `/health` require authentication via an API token passed in
|
|||||||
|
|
||||||
### Request/Response Format
|
### Request/Response Format
|
||||||
All endpoints use JSON for request and response payloads.
|
All endpoints use JSON for request and response payloads.
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
| Environment Variable | Description | Default |
|
||||||
|
|----------------------|-----------------------------------------|---------------|
|
||||||
|
| RCOND_ADDR | Address to bind the HTTP server to. | 0.0.0.0:8080 |
|
||||||
|
| RCOND_API_TOKEN | API token to use for authentication. | N/A |
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
openapi: 3.0.0
|
openapi: 3.0.0
|
||||||
info:
|
info:
|
||||||
title: rcond API
|
title: rcond API
|
||||||
description: API for managing network connections through NetworkManager
|
description: API for managing stuff on a Linux system
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|
||||||
servers:
|
servers:
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ func usage() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
addr := "0.0.0.0:8080"
|
addr := os.Getenv("RCOND_ADDR")
|
||||||
|
if addr == "" {
|
||||||
|
addr = "0.0.0.0:8080"
|
||||||
|
}
|
||||||
if len(os.Args) > 1 {
|
if len(os.Args) > 1 {
|
||||||
addr = os.Args[1]
|
addr = os.Args[1]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user