@@ -12,8 +12,9 @@ use cb_common::{
12
12
utils:: random_jwt,
13
13
} ;
14
14
use docker_compose_types:: {
15
- Compose , ComposeVolume , DependsOnOptions , Environment , Labels , LoggingParameters , MapOrEmpty ,
16
- NetworkSettings , Networks , Ports , Service , Services , SingleValue , TopLevelVolumes , Volumes ,
15
+ Compose , ComposeVolume , DependsOnOptions , EnvFile , Environment , Labels , LoggingParameters ,
16
+ MapOrEmpty , NetworkSettings , Networks , Ports , Service , Services , SingleValue , TopLevelVolumes ,
17
+ Volumes ,
17
18
} ;
18
19
use eyre:: Result ;
19
20
use indexmap:: IndexMap ;
@@ -34,7 +35,6 @@ const SIGNER_NETWORK: &str = "signer_network";
34
35
35
36
pub fn handle_docker_init ( config_path : String , output_dir : String ) -> Result < ( ) > {
36
37
println ! ( "Initializing Commit-Boost with config file: {}" , config_path) ;
37
-
38
38
let cb_config = CommitBoostConfig :: from_file ( & config_path) ?;
39
39
40
40
let metrics_enabled = cb_config. metrics . is_some ( ) ;
@@ -106,6 +106,17 @@ pub fn handle_docker_init(config_path: String, output_dir: String) -> Result<()>
106
106
get_env_interp ( MODULE_JWT_ENV , & jwt_name) ,
107
107
get_env_val ( SIGNER_SERVER_ENV , & signer_server) ,
108
108
] ) ;
109
+
110
+ // Pass on the env variables
111
+ if let Some ( envs) = module. env {
112
+ for ( k, v) in envs {
113
+ module_envs. insert ( k, Some ( SingleValue :: String ( v) ) ) ;
114
+ }
115
+ }
116
+
117
+ // Set environment file
118
+ let env_file = module. env_file . map ( EnvFile :: Simple ) ;
119
+
109
120
if metrics_enabled {
110
121
let ( key, val) = get_env_uval ( METRICS_SERVER_ENV , metrics_port as u64 ) ;
111
122
module_envs. insert ( key, val) ;
@@ -133,6 +144,7 @@ pub fn handle_docker_init(config_path: String, output_dir: String) -> Result<()>
133
144
volumes : module_volumes,
134
145
environment : Environment :: KvPair ( module_envs) ,
135
146
depends_on : DependsOnOptions :: Simple ( vec ! [ "cb_signer" . to_owned( ) ] ) ,
147
+ env_file,
136
148
..Service :: default ( )
137
149
}
138
150
}
0 commit comments