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