@@ -74,9 +74,7 @@ struct DynamicReplicatorConfig {
74
74
75
75
impl DynamicReplicatorConfig {
76
76
/// Loads the runtime limits for the current environment.
77
- fn load ( ) -> Result < Self , K8sError > {
78
- let environment = Environment :: load ( ) . map_err ( |_| K8sError :: ReplicatorConfiguration ) ?;
79
-
77
+ fn load ( environment : & Environment ) -> Result < Self , K8sError > {
80
78
let config = match environment {
81
79
Environment :: Prod => Self {
82
80
max_memory : REPLICATOR_MAX_MEMORY_PROD ,
@@ -302,6 +300,9 @@ impl K8sClient for HttpK8sClient {
302
300
) -> Result < ( ) , K8sError > {
303
301
info ! ( "patching stateful set" ) ;
304
302
303
+ let environment = Environment :: load ( ) . map_err ( |_| K8sError :: MissingEnvironment ) ?;
304
+ let config = DynamicReplicatorConfig :: load ( & environment) ?;
305
+
305
306
let stateful_set_name = format ! ( "{prefix}-{REPLICATOR_STATEFUL_SET_SUFFIX}" ) ;
306
307
let replicator_app_name = format ! ( "{prefix}-{REPLICATOR_APP_SUFFIX}" ) ;
307
308
let replicator_container_name = format ! ( "{prefix}-{REPLICATOR_CONTAINER_NAME_SUFFIX}" ) ;
@@ -310,8 +311,6 @@ impl K8sClient for HttpK8sClient {
310
311
let bq_secret_name = format ! ( "{prefix}-{BQ_SECRET_NAME_SUFFIX}" ) ;
311
312
let replicator_config_map_name = format ! ( "{prefix}-{REPLICATOR_CONFIG_MAP_NAME_SUFFIX}" ) ;
312
313
313
- let config = DynamicReplicatorConfig :: load ( ) ?;
314
-
315
314
let mut stateful_set_json = json ! ( {
316
315
"apiVersion" : "apps/v1" ,
317
316
"kind" : "StatefulSet" ,
@@ -419,7 +418,7 @@ impl K8sClient for HttpK8sClient {
419
418
"env" : [
420
419
{
421
420
"name" : "APP_ENVIRONMENT" ,
422
- "value" : "prod"
421
+ "value" : environment . to_string ( )
423
422
} ,
424
423
{
425
424
"name" : "APP_SENTRY__DSN" ,
0 commit comments