Skip to content

Commit 9fc2f35

Browse files
chore: Support chain prefix
1 parent d6ba072 commit 9fc2f35

File tree

7 files changed

+39
-6
lines changed

7 files changed

+39
-6
lines changed

Cargo.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/proxy/cert.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
# Add the extra URL to the list of generated URLs
3-
dns_names = ["${var.extension_name}.${var.dns_zone}", "*.${var.extension_name}.${var.dns_zone}"]
3+
dns_names = var.dns_names != null ? var.dns_names : ["${var.extension_name}.${var.dns_zone}", "*.${var.extension_name}.${var.dns_zone}"]
44
cert_secret_name = "${var.extension_name}-proxy-wildcard-tls"
55
}
66

bootstrap/proxy/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ variable "dns_zone" {
6464
default = "demeter.run"
6565
}
6666

67+
variable "dns_names" {
68+
description = "List of DNS names for the certificate"
69+
type = list(string)
70+
default = null
71+
}

bootstrap/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ variable "ingress_class" {
1919

2020
variable "networks" {
2121
type = list(string)
22-
default = ["mainnet", "preprod", "preview", "vector-testnet", "prime-testnet"]
22+
default = ["cardano-mainnet", "cardano-preprod", "cardano-preview", "vector-testnet", "prime-testnet"]
23+
}
24+
25+
variable "dns_names" {
26+
description = "List of DNS names for the certificate"
27+
type = list(string)
28+
default = null
2329
}
2430

2531
// Operator

proxy/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ operator = { path = "../operator" }
1010
async-trait = "0.1.77"
1111
dotenv = "0.15.0"
1212
futures-util = "0.3.30"
13+
lazy_static = "1.5.0"
1314
pingora = { version = "0.1.0", features = ["proxy"] }
1415
pingora-limits = "0.1.0"
1516
regex = "1.10.3"

proxy/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ use tiers::TierBackgroundService;
1616
use tokio::sync::RwLock;
1717
use tracing::Level;
1818

19+
use crate::utils::handle_legacy_networks;
20+
1921
mod auth;
2022
mod config;
2123
mod proxy;
2224
mod tiers;
25+
mod utils;
2326

2427
fn main() {
2528
dotenv().ok();
@@ -94,7 +97,7 @@ impl Display for Consumer {
9497
}
9598
impl From<&SubmitApiPort> for Consumer {
9699
fn from(value: &SubmitApiPort) -> Self {
97-
let network = value.spec.network.to_string();
100+
let network = handle_legacy_networks(&value.spec.network);
98101
let tier = value.spec.throughput_tier.to_string();
99102
let key = value.status.as_ref().unwrap().auth_token.clone();
100103
let namespace = value.metadata.namespace.as_ref().unwrap().clone();

proxy/src/utils.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use lazy_static::lazy_static;
2+
use std::collections::HashMap;
3+
4+
lazy_static! {
5+
static ref LEGACY_NETWORKS: HashMap<&'static str, String> = {
6+
let mut m = HashMap::new();
7+
m.insert("mainnet", "cardano-mainnet".into());
8+
m.insert("preprod", "cardano-preprod".into());
9+
m.insert("preview", "cardano-preview".into());
10+
m
11+
};
12+
}
13+
14+
pub fn handle_legacy_networks(network: &str) -> String {
15+
let default = network.to_string();
16+
LEGACY_NETWORKS.get(network).unwrap_or(&default).to_string()
17+
}

0 commit comments

Comments
 (0)