@@ -168,7 +168,7 @@ var confFileTemplate = `# ArangoDB configuration file
168
168
[server]
169
169
endpoint = tcp://0.0.0.0:%s
170
170
threads = %d
171
- authentication = false
171
+ %s
172
172
173
173
[log]
174
174
level = %s
@@ -190,20 +190,51 @@ func (s *Service) makeBaseArgs(myHostDir, myContainerDir string, myAddress strin
190
190
}
191
191
192
192
if _ , err := os .Stat (hostConfFileName ); os .IsNotExist (err ) {
193
- out , e := os .Create (hostConfFileName )
194
- if e != nil {
195
- s .log .Fatalf ("Could not create configuration file %s, error: %#v" , hostConfFileName , e )
196
- }
193
+ var threads , v8Contexts string
194
+ logLevel := "INFO"
197
195
switch mode {
198
196
// Parameters are: port, server threads, log level, v8-contexts
199
197
case "agent" :
200
- fmt .Fprintf (out , confFileTemplate , myPort , 8 , "INFO" , 1 )
198
+ threads = "8"
199
+ v8Contexts = "1"
201
200
case "dbserver" :
202
- fmt .Fprintf (out , confFileTemplate , myPort , 4 , "INFO" , 4 )
201
+ threads = "4"
202
+ v8Contexts = "4"
203
203
case "coordinator" :
204
- fmt .Fprintf (out , confFileTemplate , myPort , 16 , "INFO" , 4 )
204
+ threads = "16"
205
+ v8Contexts = "4"
206
+ }
207
+ config := configFile {
208
+ & configSection {
209
+ Name : "server" ,
210
+ Settings : map [string ]string {
211
+ "endpoint" : fmt .Sprintf ("tcp://0.0.0.0:%s" , myPort ),
212
+ "threads" : threads ,
213
+ "authentication" : "false" ,
214
+ },
215
+ },
216
+ & configSection {
217
+ Name : "log" ,
218
+ Settings : map [string ]string {
219
+ "level" : logLevel ,
220
+ },
221
+ },
222
+ & configSection {
223
+ Name : "javascript" ,
224
+ Settings : map [string ]string {
225
+ "v8-contexts" : v8Contexts ,
226
+ },
227
+ },
205
228
}
229
+ out , e := os .Create (hostConfFileName )
230
+ if e != nil {
231
+ s .log .Fatalf ("Could not create configuration file %s, error: %#v" , hostConfFileName , e )
232
+ }
233
+ _ , err := config .WriteTo (out )
206
234
out .Close ()
235
+ if err != nil {
236
+ s .log .Fatalf ("Cannot create config file: %v" , err )
237
+ }
207
238
}
208
239
args = make ([]string , 0 , 40 )
209
240
executable := s .ArangodExecutable
0 commit comments