You've already forked AstralRinth
forked from didirus/AstralRinth
Move archon to env var (#3386)
This commit is contained in:
@@ -117,3 +117,5 @@ BREX_API_KEY=none
|
|||||||
|
|
||||||
DELPHI_URL=none
|
DELPHI_URL=none
|
||||||
DELPHI_SLACK_WEBHOOK=none
|
DELPHI_SLACK_WEBHOOK=none
|
||||||
|
|
||||||
|
ARCHON_URL=none
|
||||||
@@ -502,5 +502,7 @@ pub fn check_env_vars() -> bool {
|
|||||||
|
|
||||||
failed |= check_var::<String>("DELPHI_URL");
|
failed |= check_var::<String>("DELPHI_URL");
|
||||||
|
|
||||||
|
failed |= check_var::<String>("ARCHON_URL");
|
||||||
|
|
||||||
failed
|
failed
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1749,7 +1749,8 @@ pub async fn stripe_webhook(
|
|||||||
{
|
{
|
||||||
client
|
client
|
||||||
.post(format!(
|
.post(format!(
|
||||||
"https://archon.pyro.host/modrinth/v0/servers/{}/unsuspend",
|
"{}/modrinth/v0/servers/{}/unsuspend",
|
||||||
|
dotenvy::var("ARCHON_URL")?,
|
||||||
id
|
id
|
||||||
))
|
))
|
||||||
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
||||||
@@ -1757,20 +1758,25 @@ pub async fn stripe_webhook(
|
|||||||
.await?
|
.await?
|
||||||
.error_for_status()?;
|
.error_for_status()?;
|
||||||
|
|
||||||
client.post(format!(
|
client
|
||||||
"https://archon.pyro.host/modrinth/v0/servers/{}/reallocate",
|
.post(format!(
|
||||||
|
"{}/modrinth/v0/servers/{}/reallocate",
|
||||||
|
dotenvy::var("ARCHON_URL")?,
|
||||||
id
|
id
|
||||||
))
|
))
|
||||||
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
.header(
|
||||||
.json(&serde_json::json!({
|
"X-Master-Key",
|
||||||
"memory_mb": ram,
|
dotenvy::var("PYRO_API_KEY")?,
|
||||||
"cpu": cpu,
|
)
|
||||||
"swap_mb": swap,
|
.json(&serde_json::json!({
|
||||||
"storage_mb": storage,
|
"memory_mb": ram,
|
||||||
}))
|
"cpu": cpu,
|
||||||
.send()
|
"swap_mb": swap,
|
||||||
.await?
|
"storage_mb": storage,
|
||||||
.error_for_status()?;
|
}))
|
||||||
|
.send()
|
||||||
|
.await?
|
||||||
|
.error_for_status()?;
|
||||||
} else {
|
} else {
|
||||||
let (server_name, source) = if let Some(
|
let (server_name, source) = if let Some(
|
||||||
PaymentRequestMetadata::Pyro {
|
PaymentRequestMetadata::Pyro {
|
||||||
@@ -1814,7 +1820,10 @@ pub async fn stripe_webhook(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let res = client
|
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")?)
|
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
||||||
.json(&serde_json::json!({
|
.json(&serde_json::json!({
|
||||||
"user_id": to_base62(metadata.user_item.id.0 as u64),
|
"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()
|
let res = reqwest::Client::new()
|
||||||
.post(format!(
|
.post(format!(
|
||||||
"https://archon.pyro.host/modrinth/v0/servers/{}/suspend",
|
"{}/modrinth/v0/servers/{}/suspend",
|
||||||
|
dotenvy::var("ARCHON_URL")?,
|
||||||
id
|
id
|
||||||
))
|
))
|
||||||
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
.header("X-Master-Key", dotenvy::var("PYRO_API_KEY")?)
|
||||||
|
|||||||
Reference in New Issue
Block a user