Move archon to env var (#3386)

This commit is contained in:
Jai Agrawal
2025-03-11 23:27:49 -07:00
committed by GitHub
parent 1ea196051f
commit 887e437d35
3 changed files with 30 additions and 16 deletions

View File

@@ -116,4 +116,6 @@ BREX_API_URL=https://platform.brexapis.com/v2/
BREX_API_KEY=none
DELPHI_URL=none
DELPHI_SLACK_WEBHOOK=none
DELPHI_SLACK_WEBHOOK=none
ARCHON_URL=none

View File

@@ -502,5 +502,7 @@ pub fn check_env_vars() -> bool {
failed |= check_var::<String>("DELPHI_URL");
failed |= check_var::<String>("ARCHON_URL");
failed
}

View File

@@ -1749,7 +1749,8 @@ pub async fn stripe_webhook(
{
client
.post(format!(
"https://archon.pyro.host/modrinth/v0/servers/{}/unsuspend",
"{}/modrinth/v0/servers/{}/unsuspend",
dotenvy::var("ARCHON_URL")?,
id
))
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
@@ -1757,20 +1758,25 @@ pub async fn stripe_webhook(
.await?
.error_for_status()?;
client.post(format!(
"https://archon.pyro.host/modrinth/v0/servers/{}/reallocate",
client
.post(format!(
"{}/modrinth/v0/servers/{}/reallocate",
dotenvy::var("ARCHON_URL")?,
id
))
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
.json(&serde_json::json!({
"memory_mb": ram,
"cpu": cpu,
"swap_mb": swap,
"storage_mb": storage,
}))
.send()
.await?
.error_for_status()?;
.header(
"X-Master-Key",
dotenvy::var("PYRO_API_KEY")?,
)
.json(&serde_json::json!({
"memory_mb": ram,
"cpu": cpu,
"swap_mb": swap,
"storage_mb": storage,
}))
.send()
.await?
.error_for_status()?;
} else {
let (server_name, source) = if let Some(
PaymentRequestMetadata::Pyro {
@@ -1814,7 +1820,10 @@ pub async fn stripe_webhook(
}
let res = client
.post("https://archon.pyro.host/modrinth/v0/servers/create")
.post(format!(
"{}/modrinth/v0/servers/create",
dotenvy::var("ARCHON_URL")?,
))
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
.json(&serde_json::json!({
"user_id": to_base62(metadata.user_item.id.0 as u64),
@@ -2201,7 +2210,8 @@ pub async fn subscription_task(pool: PgPool, redis: RedisPool) {
{
let res = reqwest::Client::new()
.post(format!(
"https://archon.pyro.host/modrinth/v0/servers/{}/suspend",
"{}/modrinth/v0/servers/{}/suspend",
dotenvy::var("ARCHON_URL")?,
id
))
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)