@@ -122,7 +122,7 @@ export async function checkSrcConnection(tmpDir: string, image: string, srcConfi
122
122
*
123
123
* @argument command - for testing purposes only
124
124
*/
125
- export async function runSrcSync ( tmpDir : string , config : FarosConfig , command ?: string [ ] ) : Promise < string > {
125
+ export async function runSrcSync ( tmpDir : string , config : FarosConfig ) : Promise < string > {
126
126
logger . info ( 'Running source connector...' ) ;
127
127
128
128
if ( ! config . src ?. image ) {
@@ -132,7 +132,7 @@ export async function runSrcSync(tmpDir: string, config: FarosConfig, command?:
132
132
try {
133
133
const timestamp = Date . now ( ) ;
134
134
const srcContainerName = `airbyte-local-src-${ timestamp } ` ;
135
- const cmd = command ?? [
135
+ const cmd = [
136
136
'read' ,
137
137
'--config' ,
138
138
`/configs/${ SRC_CONFIG_FILENAME } ` ,
@@ -146,13 +146,19 @@ export async function runSrcSync(tmpDir: string, config: FarosConfig, command?:
146
146
const maxMemory =
147
147
config . src ?. dockerOptions ?. maxMemory !== undefined ? config . src . dockerOptions . maxMemory * 1024 * 1024 : undefined ;
148
148
const createOptions : Docker . ContainerCreateOptions = {
149
+ // Default config: can be overridden by the docker options provided by users
149
150
name : srcContainerName ,
150
151
Image : config . src . image ,
152
+ ...config . src ?. dockerOptions ?. additionalOptions ,
153
+
154
+ // Default options: cannot be overridden by users
151
155
Cmd : cmd ,
156
+ AttachStdout : true ,
157
+ AttachStderr : true ,
158
+ platform : 'linux/amd64' ,
159
+ Env : [ `LOG_LEVEL=${ config . logLevel } ` , ...( config . src ?. dockerOptions ?. additionalOptions ?. Env || [ ] ) ] ,
152
160
HostConfig : {
153
- Binds : [ `${ tmpDir } :/configs` ] ,
154
- AutoRemove : true ,
155
- Init : true ,
161
+ // Defautl host config: can be overridden by users
156
162
NanoCpus : maxNanoCpus , // 1e9 nano cpus = 1 cpu
157
163
Memory : maxMemory , // 1024 * 1024 bytes = 1MB
158
164
LogConfig : {
@@ -161,11 +167,12 @@ export async function runSrcSync(tmpDir: string, config: FarosConfig, command?:
161
167
'max-size' : config . src ?. dockerOptions ?. maxLogSize ?? DEFAULT_MAX_LOG_SIZE ,
162
168
} ,
163
169
} ,
170
+ ...config . src ?. dockerOptions ?. additionalOptions ?. HostConfig ,
171
+ // Default options: cannot be overridden by users
172
+ Binds : [ `${ tmpDir } :/configs` ] ,
173
+ AutoRemove : true ,
174
+ Init : true ,
164
175
} ,
165
- AttachStdout : true ,
166
- AttachStderr : true ,
167
- Env : [ `LOG_LEVEL=${ config . logLevel } ` ] ,
168
- platform : 'linux/amd64' ,
169
176
} ;
170
177
171
178
// Create the Docker container
0 commit comments