Skip to content

Commit

Permalink
fix: always sort env vars after override (#168)
Browse files Browse the repository at this point in the history
* fix: always sort env vars after override

* fix: make clippy happy
  • Loading branch information
smrz2001 authored May 2, 2024
1 parent 97fbdb6 commit 71f1413
Show file tree
Hide file tree
Showing 21 changed files with 1,057 additions and 1,362 deletions.
4 changes: 2 additions & 2 deletions operator/src/network/cas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::{
resource_limits::ResourceLimitsConfig,
CasApiSpec, CasSpec,
},
utils::override_env_vars,
utils::override_and_sort_env_vars,
};

const CAS_IPFS_INFO_SUFFIX: &str = "cas";
Expand Down Expand Up @@ -309,7 +309,7 @@ pub fn cas_stateful_set_spec(
datadog.inject_env(&mut cas_api_env);

// Apply the CAS API env overrides, if specified.
override_env_vars(&mut cas_api_env, &config.api.env);
override_and_sort_env_vars(&mut cas_api_env, &config.api.env);

StatefulSetSpec {
replicas: Some(1),
Expand Down
4 changes: 2 additions & 2 deletions operator/src/network/ceramic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::{
resource_limits::ResourceLimitsConfig,
CeramicSpec, NetworkSpec, NetworkType,
},
utils::override_env_vars,
utils::override_and_sort_env_vars,
};

use super::debug_mode_security_context;
Expand Down Expand Up @@ -402,7 +402,7 @@ pub fn stateful_set_spec(ns: &str, bundle: &CeramicBundle<'_>) -> StatefulSetSpe
}

// Apply env overrides, if specified.
override_env_vars(&mut ceramic_env, &bundle.config.env);
override_and_sort_env_vars(&mut ceramic_env, &bundle.config.env);

let mut init_env = vec![EnvVar {
name: "CERAMIC_ADMIN_PRIVATE_KEY".to_owned(),
Expand Down
622 changes: 160 additions & 462 deletions operator/src/network/controller.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions operator/src/network/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
resource_limits::ResourceLimitsConfig, GoIpfsSpec, IpfsSpec, RustIpfsSpec,
NETWORK_LOCAL_ID,
},
utils::override_env_vars,
utils::override_and_sort_env_vars,
};

use super::debug_mode_security_context;
Expand Down Expand Up @@ -203,7 +203,7 @@ impl RustIpfsConfig {
}

// Apply env overrides, if specified.
override_env_vars(&mut env, &self.env);
override_and_sort_env_vars(&mut env, &self.env);

// Construct the set of ports
let mut ports = vec![
Expand Down
96 changes: 48 additions & 48 deletions operator/src/network/testdata/ceramic_go_ss_1
Original file line number Diff line number Diff line change
Expand Up @@ -46,62 +46,62 @@ Request {
],
"env": [
{
"name": "CERAMIC_NETWORK",
"value": "local"
"name": "CAS_API_URL",
"value": "http://cas:8081"
},
{
"name": "ETH_RPC_URL",
"value": "http://ganache:8545"
"name": "CERAMIC_CORS_ALLOWED_ORIGINS",
"value": ".*"
},
{
"name": "CAS_API_URL",
"value": "http://cas:8081"
"name": "CERAMIC_IPFS_HOST",
"value": "http://localhost:5001"
},
{
"name": "CERAMIC_SQLITE_PATH",
"value": "/ceramic-data/ceramic.db"
"name": "CERAMIC_LOG_LEVEL",
"value": "2"
},
{
"name": "CERAMIC_STATE_STORE_PATH",
"value": "/ceramic-data/statestore"
"name": "CERAMIC_NETWORK",
"value": "local"
},
{
"name": "CERAMIC_IPFS_HOST",
"value": "http://localhost:5001"
"name": "CERAMIC_NETWORK_TOPIC",
"value": "/ceramic/local-0"
},
{
"name": "CERAMIC_CORS_ALLOWED_ORIGINS",
"value": ".*"
"name": "CERAMIC_SQLITE_PATH",
"value": "/ceramic-data/ceramic.db"
},
{
"name": "CERAMIC_LOG_LEVEL",
"value": "2"
"name": "CERAMIC_STATE_STORE_PATH",
"value": "/ceramic-data/statestore"
},
{
"name": "ETH_RPC_URL",
"value": "http://ganache:8545"
},
{
"name": "POSTGRES_DB",
"value": "ceramic"
},
{
"name": "POSTGRES_USER",
"name": "POSTGRES_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"key": "username",
"key": "password",
"name": "ceramic-postgres-auth"
}
}
},
{
"name": "POSTGRES_PASSWORD",
"name": "POSTGRES_USER",
"valueFrom": {
"secretKeyRef": {
"key": "password",
"key": "username",
"name": "ceramic-postgres-auth"
}
}
},
{
"name": "CERAMIC_NETWORK_TOPIC",
"value": "/ceramic/local-0"
}
],
"image": "ceramicnetwork/composedb:latest",
Expand Down Expand Up @@ -281,62 +281,62 @@ Request {
}
},
{
"name": "CERAMIC_NETWORK",
"value": "local"
"name": "CAS_API_URL",
"value": "http://cas:8081"
},
{
"name": "ETH_RPC_URL",
"value": "http://ganache:8545"
"name": "CERAMIC_CORS_ALLOWED_ORIGINS",
"value": ".*"
},
{
"name": "CAS_API_URL",
"value": "http://cas:8081"
"name": "CERAMIC_IPFS_HOST",
"value": "http://localhost:5001"
},
{
"name": "CERAMIC_SQLITE_PATH",
"value": "/ceramic-data/ceramic.db"
"name": "CERAMIC_LOG_LEVEL",
"value": "2"
},
{
"name": "CERAMIC_STATE_STORE_PATH",
"value": "/ceramic-data/statestore"
"name": "CERAMIC_NETWORK",
"value": "local"
},
{
"name": "CERAMIC_IPFS_HOST",
"value": "http://localhost:5001"
"name": "CERAMIC_NETWORK_TOPIC",
"value": "/ceramic/local-0"
},
{
"name": "CERAMIC_CORS_ALLOWED_ORIGINS",
"value": ".*"
"name": "CERAMIC_SQLITE_PATH",
"value": "/ceramic-data/ceramic.db"
},
{
"name": "CERAMIC_LOG_LEVEL",
"value": "2"
"name": "CERAMIC_STATE_STORE_PATH",
"value": "/ceramic-data/statestore"
},
{
"name": "ETH_RPC_URL",
"value": "http://ganache:8545"
},
{
"name": "POSTGRES_DB",
"value": "ceramic"
},
{
"name": "POSTGRES_USER",
"name": "POSTGRES_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"key": "username",
"key": "password",
"name": "ceramic-postgres-auth"
}
}
},
{
"name": "POSTGRES_PASSWORD",
"name": "POSTGRES_USER",
"valueFrom": {
"secretKeyRef": {
"key": "password",
"key": "username",
"name": "ceramic-postgres-auth"
}
}
},
{
"name": "CERAMIC_NETWORK_TOPIC",
"value": "/ceramic/local-0"
}
],
"image": "ceramicnetwork/composedb-cli:latest",
Expand Down
Loading

0 comments on commit 71f1413

Please sign in to comment.