Skip to content

Commit

Permalink
Adding main config options to Ocsigen_server.start
Browse files Browse the repository at this point in the history
  • Loading branch information
balat committed Jun 7, 2024
1 parent 596149e commit 70ccb7a
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 2 deletions.
46 changes: 45 additions & 1 deletion src/server/ocsigen_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,51 @@ let exec config =
Lwt_log.ign_warning ~section "Multiple servers not supported anymore"
(* Multiple servers not supported any more *)

let start instructions =
let start ?(ports = [`All, 8080]) ?ssl_ports ?ssl_info ?default_charset ?logdir
?datadir ?syslog_facility ?configfile ?usedefaulthostname ?pidfile ?mimefile
?verbose ?veryverbose ?silent ?daemon ?debug ?debugmode ?minthreads
?maxthreads ?max_number_of_threads_queued ?max_number_of_connections
?client_timeout ?server_timeout ?shutdown_timeout ?filebuffersize
?maxrequestbodysize ?maxrequestbodysizeinmemory ?bindir ?extdir
?command_pipe ?disablepartialrequests ?respect_pipeline ?maxretries
instructions
=
Ocsigen_config.set_ports ports;
Option.iter Ocsigen_config.set_ssl_ports ssl_ports;
Option.iter Ocsigen_config.set_logdir logdir;
Option.iter Ocsigen_config.set_syslog_facility syslog_facility;
Option.iter Ocsigen_config.set_configfile configfile;
Option.iter Ocsigen_config.set_pidfile pidfile;
Option.iter Ocsigen_config.set_mimefile mimefile;
Option.iter Ocsigen_config.set_verbose verbose;
Option.iter Ocsigen_config.set_silent silent;
Option.iter Ocsigen_config.set_daemon daemon;
Option.iter Ocsigen_config.set_veryverbose veryverbose;
Option.iter Ocsigen_config.set_debug debug;
Option.iter Ocsigen_config.set_minthreads minthreads;
Option.iter Ocsigen_config.set_maxthreads maxthreads;
Option.iter Ocsigen_config.set_max_number_of_threads_queued
max_number_of_threads_queued;
Option.iter Ocsigen_config.set_max_number_of_connections
max_number_of_connections;
Option.iter Ocsigen_config.set_client_timeout client_timeout;
Option.iter Ocsigen_config.set_server_timeout server_timeout;
Option.iter Ocsigen_config.set_filebuffersize filebuffersize;
Option.iter Ocsigen_config.set_maxrequestbodysize maxrequestbodysize;
Option.iter Ocsigen_config.set_maxrequestbodysizeinmemory
maxrequestbodysizeinmemory;
Option.iter Ocsigen_config.set_default_charset default_charset;
Option.iter Ocsigen_config.set_datadir datadir;
Option.iter Ocsigen_config.set_bindir bindir;
Option.iter Ocsigen_config.set_extdir extdir;
Option.iter Ocsigen_config.set_command_pipe command_pipe;
Option.iter Ocsigen_config.set_debugmode debugmode;
Option.iter Ocsigen_config.set_disablepartialrequests disablepartialrequests;
Option.iter Ocsigen_config.set_usedefaulthostname usedefaulthostname;
Option.iter Ocsigen_config.set_respect_pipeline respect_pipeline;
Option.iter Ocsigen_config.set_maxretries maxretries;
Option.iter Ocsigen_config.set_shutdown_timeout shutdown_timeout;
Option.iter Ocsigen_config.set_ssl_info ssl_info;
main (fun () ->
Ocsigen_extensions.start_initialisation ();
Ocsigen_extensions.set_hosts instructions)
37 changes: 36 additions & 1 deletion src/server/ocsigen_server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,42 @@ val reload : ?file:string -> unit -> unit
val exec : Xml.xml list list -> unit
(** Start the server with a configuration file. Never returns. *)

val start : Ocsigen_extensions.host_config list -> unit
val start :
?ports:(Ocsigen_config.Socket_type.t * int) list
-> ?ssl_ports:(Ocsigen_config.Socket_type.t * int) list
-> ?ssl_info:Ocsigen_config.ssl_info option
-> ?default_charset:string option
-> ?logdir:string
-> ?datadir:string
-> ?syslog_facility:Lwt_log.syslog_facility option
-> ?configfile:string
-> ?usedefaulthostname:bool
-> ?pidfile:string
-> ?mimefile:string
-> ?verbose:unit
-> ?veryverbose:unit
-> ?silent:unit
-> ?daemon:unit
-> ?debug:unit
-> ?debugmode:bool
-> ?minthreads:int
-> ?maxthreads:int
-> ?max_number_of_threads_queued:int
-> ?max_number_of_connections:int
-> ?client_timeout:int
-> ?server_timeout:int
-> ?shutdown_timeout:float option
-> ?filebuffersize:int
-> ?maxrequestbodysize:int64 option
-> ?maxrequestbodysizeinmemory:int
-> ?bindir:string
-> ?extdir:string
-> ?command_pipe:string
-> ?disablepartialrequests:bool
-> ?respect_pipeline:unit
-> ?maxretries:int
-> Ocsigen_extensions.host_config list
-> unit
(** Start the server with some instructions. Never returns. *)

type instruction =
Expand Down

0 comments on commit 70ccb7a

Please sign in to comment.