File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1119,6 +1119,21 @@ let setup_lwt config answer =
1119
1119
let server_lwt config answer =
1120
1120
Lwt_main. run @@ setup_lwt config answer
1121
1121
1122
+ let http_bind addr http_config =
1123
+ match addr, Systemd.Daemon. listen_fds_lwt () with
1124
+ | None , [] ->
1125
+ log#error " bind not provided and no systemd socket available" ;
1126
+ exit 1
1127
+ | None , fd :: fds ->
1128
+ log#info " starting httpev in systemd mode" ;
1129
+ if fds <> [] then
1130
+ log#warn " more than one fd is provided by systemd, only the first one is used and the other ones are ignored" ;
1131
+ setup_fd_lwt fd http_config, " systemd socket"
1132
+ | Some bind , _ ->
1133
+ let connection = Nix. sockaddr_of_string bind in
1134
+ let signature = sprintf " listen %s" (Nix. show_addr connection) in
1135
+ setup_lwt { http_config with connection }, signature
1136
+
1122
1137
module Answer = struct
1123
1138
1124
1139
let return ?(status =`Ok ) ?(extra =[] ) ~typ data : [> `Body of reply_status reply' ] Lwt.t =
You can’t perform that action at this time.
0 commit comments