Private
Public Access
CI / rust (push) Successful in 3m6s
CI / go (push) Successful in 33s
CI / js (push) Successful in 34s
Standalone clients that resolve a machine unique ID (OS machine ID first, falling back to a generated UUID persisted to disk), detect hostname/IP/ container/orchestrator, and register+re-ping origin.warky.dev's public service-checkin endpoint on a daily interval. Ported from icy2's internal origincheckin package but extended to the full check-in contract and made dependency-light for external reuse. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
51 lines
1.9 KiB
Rust
51 lines
1.9 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// Payload is the JSON body posted to Origin's public service-checkin
|
|
/// endpoint. Field names and requiredness mirror
|
|
/// `POST /api/public/service-checkin` as documented in
|
|
/// `origin/doc/service-checkin.md`: `type`, `version`, `name`, and
|
|
/// `unique_install_id` are required; everything else is optional and, when
|
|
/// omitted, does not overwrite existing instance data on Origin's side.
|
|
#[derive(Debug, Clone, Default, Serialize)]
|
|
pub struct Payload {
|
|
#[serde(rename = "type")]
|
|
pub type_: String,
|
|
pub version: String,
|
|
pub name: String,
|
|
pub unique_install_id: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub site: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub environment: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub database_type: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub database_name: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub app_type: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub hostname: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub port: Option<u16>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub base_url: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub internal_url: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub container_id: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub orchestrator: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub description: Option<String>,
|
|
}
|
|
|
|
/// CheckinResponse is returned by Origin after a successful check-in.
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct CheckinResponse {
|
|
pub success: bool,
|
|
pub service_instance_id: i64,
|
|
pub unique_install_id: String,
|
|
pub status: String,
|
|
pub pinged_at: String,
|
|
}
|