Changeset 48 in code for trunk/partage.go
- Timestamp:
- Oct 20, 2021, 7:44:48 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/partage.go
r46 r48 41 41 group string 42 42 chroot string 43 bindstring43 listen string 44 44 baseuri string 45 45 rootdir string … … 255 255 } 256 256 257 conf. bind = cfg.Section("").Key("bind").String()257 conf.listen = cfg.Section("").Key("listen").String() 258 258 conf.user = cfg.Section("").Key("user").String() 259 259 conf.group = cfg.Section("").Key("group").String() … … 298 298 299 299 /* default values */ 300 conf. bind= "0.0.0.0:8080"300 conf.listen = "0.0.0.0:8080" 301 301 conf.baseuri = "http://127.0.0.1:8080" 302 302 conf.rootdir = "static" … … 327 327 } 328 328 329 if conf. bind[0] == '/' {330 listener, err = net.Listen("unix", conf. bind)329 if conf.listen[0] == '/' { 330 listener, err = net.Listen("unix", conf.listen) 331 331 if err != nil { 332 332 log.Fatal(err) … … 334 334 335 335 /* Ensure unix socket is removed on exit */ 336 defer os.Remove(conf. bind)336 defer os.Remove(conf.listen) 337 337 sigs := make(chan os.Signal, 1) 338 338 signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) 339 339 go func() { 340 340 _ = <-sigs 341 os.Remove(conf. bind)341 os.Remove(conf.listen) 342 342 os.Exit(0) 343 343 }() 344 344 } else { 345 listener, err = net.Listen("tcp", conf. bind)345 listener, err = net.Listen("tcp", conf.listen) 346 346 if err != nil { 347 347 log.Fatal(err) … … 359 359 360 360 if listener.Addr().Network() == "unix" { 361 os.Chown(conf. bind, uid, gid)361 os.Chown(conf.listen, uid, gid) 362 362 } 363 363 … … 370 370 371 371 if verbose { 372 log.Printf("Listening on %s", conf. bind)372 log.Printf("Listening on %s", conf.listen) 373 373 } 374 374
Note:
See TracChangeset
for help on using the changeset viewer.