Skip to content

Commit 17e4063

Browse files
committed
Move archon to env var
1 parent 1ea1960 commit 17e4063

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

apps/labrinth/.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,6 @@ BREX_API_URL=https://platform.brexapis.com/v2/
116116
BREX_API_KEY=none
117117

118118
DELPHI_URL=none
119-
DELPHI_SLACK_WEBHOOK=none
119+
DELPHI_SLACK_WEBHOOK=none
120+
121+
ARCHON_URL=none

apps/labrinth/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,7 @@ pub fn check_env_vars() -> bool {
502502

503503
failed |= check_var::<String>("DELPHI_URL");
504504

505+
failed |= check_var::<String>("ARCHON_URL");
506+
505507
failed
506508
}

apps/labrinth/src/routes/internal/billing.rs

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,28 +1749,34 @@ pub async fn stripe_webhook(
17491749
{
17501750
client
17511751
.post(format!(
1752-
"https://archon.pyro.host/modrinth/v0/servers/{}/unsuspend",
1752+
"{}/modrinth/v0/servers/{}/unsuspend",
1753+
dotenvy::var("ARCHON_URL")?,
17531754
id
17541755
))
17551756
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
17561757
.send()
17571758
.await?
17581759
.error_for_status()?;
17591760

1760-
client.post(format!(
1761-
"https://archon.pyro.host/modrinth/v0/servers/{}/reallocate",
1761+
client
1762+
.post(format!(
1763+
"{}/modrinth/v0/servers/{}/reallocate",
1764+
dotenvy::var("ARCHON_URL")?,
17621765
id
17631766
))
1764-
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
1765-
.json(&serde_json::json!({
1766-
"memory_mb": ram,
1767-
"cpu": cpu,
1768-
"swap_mb": swap,
1769-
"storage_mb": storage,
1770-
}))
1771-
.send()
1772-
.await?
1773-
.error_for_status()?;
1767+
.header(
1768+
"X-Master-Key",
1769+
dotenvy::var("PYRO_API_KEY")?,
1770+
)
1771+
.json(&serde_json::json!({
1772+
"memory_mb": ram,
1773+
"cpu": cpu,
1774+
"swap_mb": swap,
1775+
"storage_mb": storage,
1776+
}))
1777+
.send()
1778+
.await?
1779+
.error_for_status()?;
17741780
} else {
17751781
let (server_name, source) = if let Some(
17761782
PaymentRequestMetadata::Pyro {
@@ -1814,7 +1820,10 @@ pub async fn stripe_webhook(
18141820
}
18151821

18161822
let res = client
1817-
.post("https://archon.pyro.host/modrinth/v0/servers/create")
1823+
.post(format!(
1824+
"{}/modrinth/v0/servers/create",
1825+
dotenvy::var("ARCHON_URL")?,
1826+
))
18181827
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
18191828
.json(&serde_json::json!({
18201829
"user_id": to_base62(metadata.user_item.id.0 as u64),
@@ -2201,7 +2210,8 @@ pub async fn subscription_task(pool: PgPool, redis: RedisPool) {
22012210
{
22022211
let res = reqwest::Client::new()
22032212
.post(format!(
2204-
"https://archon.pyro.host/modrinth/v0/servers/{}/suspend",
2213+
"{}/modrinth/v0/servers/{}/suspend",
2214+
dotenvy::var("ARCHON_URL")?,
22052215
id
22062216
))
22072217
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)

0 commit comments

Comments
 (0)