Skip to content

Commit

Permalink
feat(operator): updated config ingress_class to extension_name
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Feb 23, 2024
1 parent e8979da commit 5c9ebc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ This operator allows demeter to run and expose ogmios

## Environment

| Key | Value |
| ------------- | ------------ |
| ADDR | 0.0.0.0:5000 |
| DNS_ZONE | demeter.run |
| INGRESS_CLASS | ogmios-v1 |
| API_KEY_SALT | ogmios-salt |
| Key | Value |
| -------------- | ------------ |
| ADDR | 0.0.0.0:5000 |
| DNS_ZONE | demeter.run |
| EXTENSION_NAME | ogmios-m1 |
| API_KEY_SALT | ogmios-salt |

## Commands

Expand Down
6 changes: 3 additions & 3 deletions operator/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn get_config() -> &'static Config {
#[derive(Debug, Clone)]
pub struct Config {
pub dns_zone: String,
pub ingress_class: String,
pub extension_name: String,
pub api_key_salt: String,
pub dcu_per_frame: HashMap<String, f64>,
pub metrics_delay: Duration,
Expand All @@ -22,7 +22,7 @@ pub struct Config {
impl Config {
pub fn from_env() -> Self {
let dns_zone = env::var("DNS_ZONE").unwrap_or("demeter.run".into());
let ingress_class = env::var("INGRESS_CLASS").unwrap_or("ogmios-m1".into());
let extension_name = env::var("EXTENSION_NAME").unwrap_or("ogmios-m1".into());
let api_key_salt = env::var("API_KEY_SALT").unwrap_or("ogmios-salt".into());
let dcu_per_frame = env::var("DCU_PER_FRAME")
.expect("DCU_PER_FRAME must be set")
Expand All @@ -47,7 +47,7 @@ impl Config {

Self {
dns_zone,
ingress_class,
extension_name,
api_key_salt,
dcu_per_frame,
metrics_delay,
Expand Down
6 changes: 3 additions & 3 deletions operator/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ pub async fn patch_resource_status(

pub fn build_hostname(network: &Network, version: &u8, key: &str) -> (String, String) {
let config = get_config();
let ingress_class = &config.ingress_class;
let extension_name = &config.extension_name;
let dns_zone = &config.dns_zone;

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_name}.{dns_zone}");
let hostname_key = format!("{key}.{network}-v{version}.{extension_name}.{dns_zone}");

(hostname, hostname_key)
}
Expand Down

0 comments on commit 5c9ebc1

Please sign in to comment.