@@ -78,31 +78,33 @@ def enable_systemd_unit
78
78
create_podman_secret
79
79
end
80
80
81
- def unit_environment_variables
81
+ def environment_variables
82
+ super . merge (
83
+ "PORT" => container_port . to_s ,
84
+ "LOG4JS_LEVEL" => ::Settings . log . level_embedded_terraform ,
85
+ "TF_OFFLINE" => worker_settings [ :opentofu_offline ] . to_s
86
+ )
87
+ end
88
+
89
+ def systemd_environment_variables
82
90
{
83
91
"DATABASE_HOSTNAME" => database_configuration [ :host ] ,
84
92
"DATABASE_NAME" => database_configuration [ :database ] ,
85
93
"DATABASE_USERNAME" => database_configuration [ :username ] ,
86
94
"MEMCACHE_SERVERS" => ::Settings . session . memcache_server ,
87
- "PORT" => container_port ,
88
- "OPENTOFU_RUNNER_IMAGE" => container_image ,
89
- "LOG4JS_LEVEL" => ::Settings . log . level_embedded_terraform ,
90
- "TF_OFFLINE" => worker_settings [ :opentofu_offline ]
95
+ "OPENTOFU_RUNNER_IMAGE" => container_image
91
96
}
92
97
end
93
98
99
+ def container_environment_variables
100
+ super . merge ( "HOME" => "/home/node" )
101
+ end
102
+
94
103
def configure_service_worker_deployment ( definition )
95
104
super
96
105
# overwriting container port to be same as opentofu-runner service port i.e. in this case 6000
97
106
definition [ :spec ] [ :template ] [ :spec ] [ :containers ] . first [ :ports ] = [ { :containerPort => container_port } ]
98
107
99
- # ovewriting home directory to terraform home dir
100
- env_var_array = definition [ :spec ] [ :template ] [ :spec ] [ :containers ] [ 0 ] [ :env ]
101
- env_var_array . detect { |env | env [ :name ] == "HOME" } &.[]=( :value , "/home/node" )
102
-
103
- definition [ :spec ] [ :template ] [ :spec ] [ :containers ] [ 0 ] [ :env ] << { :name => "LOG4JS_LEVEL" , :value => Settings . log . level_embedded_terraform }
104
- definition [ :spec ] [ :template ] [ :spec ] [ :containers ] [ 0 ] [ :env ] << { :name => "TF_OFFLINE" , :value => worker_settings [ :opentofu_offline ] . to_s }
105
-
106
108
# these volume mounts are require by terraform runner to create the stack, mentioned it as {} so that it can be writable
107
109
definition [ :spec ] [ :template ] [ :spec ] [ :containers ] . first [ :volumeMounts ] << { :name => "terraform-bin-empty" , :mountPath => "/home/node/terraform/bin" }
108
110
definition [ :spec ] [ :template ] [ :spec ] [ :volumes ] << { :name => "stacks-empty" , :emptyDir => { } }
0 commit comments