Skip to content

Commit

Permalink
fix: Add extension subdomain variable (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezzfelipe authored Mar 4, 2024
1 parent 33735dc commit 05f1bc9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions bootstrap/feature/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ variable "ingress_class" {
type = string
}

variable "extension_subdomain" {
type = string
}

variable "dns_zone" {
default = "demeter.run"
}
Expand Down
5 changes: 5 additions & 0 deletions bootstrap/feature/operator.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ resource "kubernetes_deployment_v1" "operator" {
value = var.ingress_class
}

env {
name = "EXTENSION_SUBDOMAIN"
value = var.extension_subdomain
}

env {
name = "DNS_ZONE"
value = var.dns_zone
Expand Down
2 changes: 1 addition & 1 deletion operator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ext-cardano-kupo"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
default-run = "controller"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 3 additions & 1 deletion operator/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct Config {
pub dns_zone: String,

pub ingress_class: String,
pub extension_subdomain: String,
pub api_key_salt: String,

pub metrics_delay: Duration,
Expand All @@ -30,7 +31,8 @@ impl Config {
pub fn from_env() -> Self {
Self {
dns_zone: env::var("DNS_ZONE").unwrap_or("demeter.run".into()),
ingress_class: env::var("INGRESS_CLASS").unwrap_or("kupo-m1".into()),
ingress_class: env::var("INGRESS_CLASS").unwrap_or("kupo-v1".into()),
extension_subdomain: env::var("EXTENSION_SUBDOMAIN").unwrap_or("kupo-m1".into()),
api_key_salt: env::var("API_KEY_SALT").unwrap_or("kupo-salt".into()),

metrics_delay: Duration::from_secs(
Expand Down
6 changes: 3 additions & 3 deletions operator/src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ pub fn build_hostname(
kupo_version: &Option<String>,
) -> (String, String) {
let config = get_config();
let ingress_class = &config.ingress_class;
let extension_subdomain = &config.extension_subdomain;
let dns_zone = &config.dns_zone;
let version = kupo_version
.clone()
.unwrap_or(config.default_kupo_version.to_string());

let hostname = format!("{network}-v{version}.{ingress_class}.{dns_zone}");
let hostname_key = format!("{key}.{network}-v{version}.{ingress_class}.{dns_zone}");
let hostname = format!("{network}-v{version}.{extension_subdomain}.{dns_zone}");
let hostname_key = format!("{key}.{network}-v{version}.{extension_subdomain}.{dns_zone}");

(hostname, hostname_key)
}
Expand Down

0 comments on commit 05f1bc9

Please sign in to comment.