Fix outstanding bugs
[pkg-ocaml-ocsigen.git] / baselib / ocsigen_config.ml.in
blob58a0cc837a24bd8f76cd6817779ab13b454193c0
1 (* Warning! ocsigen_config.ml is generated automatically from ocsigen_config.ml.in!
2 Do not modify it manually *)
3 (* Ocsigen
4 * Copyright (C) 2005 Vincent Balat
5 * Laboratoire PPS - CNRS Université Paris Diderot
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, with linking exception;
10 * either version 2.1 of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 open Ocsigen_lib
24 exception Config_file_error of string
26 (* General config *)
27 let config_file = ref "_CONFIGDIR_/_OCSIGENNAME_.conf"
28 let verbose = ref false
29 let silent = ref false
30 let daemon = ref false
31 let veryverbose = ref false
32 let version_number = (**)"0000000000000000"(**)
33 let mimefile = ref "_CONFIGDIR_/mime.types"
34 let pidfile = ref None
35 let server_name = "Ocsigen"
36 let full_server_name = server_name^"/"^version_number
37 let is_native = _ISNATIVE_
39 let builtin_packages =
40 List.fold_left (fun a s -> StringSet.add s a) StringSet.empty
41 ["unix"; "threads"; "ssl"; "react"; "lwt.unix";
42 "lwt"; "lwt.preemptive"; "lwt.ssl"; "lwt.extra";
43 "netstring"; "netsys"; "pcre"; "dynlink"; "findlib";
44 "ocsigen"; "ocsigen.server"; "ocsigen_xhtml";
45 "camlp4.lib"; "ocsigen.ext.polytables"]
47 (* Server config: *)
48 let (uploaddir : string option ref) = ref None
49 let logdir = ref "_LOGDIR_"
50 let default_user = ref "_OCSIGENUSER_"
51 let default_group = ref "_OCSIGENGROUP_"
52 let minthreads = ref 10
53 let maxthreads = ref 30
54 let max_number_of_connections = ref 350
55 let mimefile = ref "_CONFIGDIR_/mime.types"
56 let silent_client_timeout = ref 30 (* without speaking during sending frame *)
57 let silent_server_timeout = ref 30 (* without speaking during sending frame *)
58 (*let keepalive_timeout = ref 30
59 let keepopen_timeout = ref 300 (* for ocsigen as client *) *)
60 let netbuffersize = ref 8192
61 let filebuffersize = ref 8192
62 let maxrequestbodysize = ref (Some (Int64.of_int 8000000))
63 let maxuploadfilesize = ref (Some (Int64.of_int 2000000))
64 let defaultcharset = ref (None : string option)
65 let datadir = ref "_DATADIR_"
66 let bindir = ref "_BINDIR_"
67 let extralibdir = ref "_EXTRALIBDIR_"
68 let user = ref (Some !default_user)
69 let group = ref (Some !default_group)
70 let command_pipe = ref "_COMMANDPIPE_"
71 let debugmode = ref false
72 let disablepartialrequests = ref false
73 let usedefaulthostname = ref false
74 let respectpipeline = ref false
75 let default_port = ref 80
76 let default_sslport = ref 443
77 let maxretries = ref 10
78 let shutdowntimeout = ref (Some 10.)
80 let set_uploaddir u = uploaddir := u
81 let set_logdir s = logdir := s
82 let set_configfile s = config_file := s
83 let set_pidfile s = pidfile := Some s
84 let set_mimefile s = mimefile := s
85 let set_verbose () = verbose := true
86 let set_silent () = silent := true
87 let set_daemon () = set_silent (); daemon := true
88 let set_veryverbose () = verbose := true; veryverbose := true
89 let set_minthreads i = minthreads := i
90 let set_maxthreads i = maxthreads := i
91 let set_max_number_of_threads_queued =
92 Lwt_preemptive.set_max_number_of_threads_queued
93 let set_max_number_of_connections i = max_number_of_connections := i
94 let set_client_timeout i = silent_client_timeout := i
95 let set_server_timeout i = silent_server_timeout := i
96 (* let set_keepalive_timeout i = keepalive_timeout := i
97 let set_keepopen_timeout i = keepopen_timeout := i *)
98 let set_netbuffersize i = netbuffersize := i
99 let set_filebuffersize i = filebuffersize := i
100 let set_maxuploadfilesize i = maxuploadfilesize := i
101 let set_maxrequestbodysize i = maxrequestbodysize := i
102 let set_default_charset o = defaultcharset := o
103 let set_datadir o = datadir := o
104 let set_bindir o = bindir := o
105 let set_extralibdir o = extralibdir := o
106 let set_user o = user := o
107 let set_group o = group := o
108 let set_command_pipe s = command_pipe := s
109 let set_debugmode s = debugmode := s
110 let set_disablepartialrequests s = disablepartialrequests := s
111 let set_usedefaulthostname s = usedefaulthostname := s
112 let set_respect_pipeline () = respectpipeline := true
113 let set_default_port p = default_port := p
114 let set_default_sslport p = default_sslport := p
115 let set_maxretries i = maxretries := i
116 let set_shutdown_timeout s = shutdowntimeout := s
118 let get_uploaddir () = !uploaddir
119 let get_logdir () = !logdir
120 let get_config_file () = !config_file
121 let get_pidfile () = !pidfile
122 let get_mimefile () = !mimefile
123 let get_verbose () = !verbose
124 let get_silent () = !silent
125 let get_daemon () = !daemon
126 let get_veryverbose () = !veryverbose
127 let get_default_user () = !default_user
128 let get_default_group () = !default_group
129 let get_minthreads () = !minthreads
130 let get_maxthreads () = !maxthreads
131 let get_max_number_of_threads_queued =
132 Lwt_preemptive.get_max_number_of_threads_queued
133 let get_max_number_of_connections () = !max_number_of_connections
134 let get_client_timeout () = !silent_client_timeout
135 let get_server_timeout () = !silent_server_timeout
136 (*let get_keepalive_timeout () = !keepalive_timeout
137 let get_keepopen_timeout () = !keepopen_timeout *)
138 let get_netbuffersize () = !netbuffersize
139 let get_filebuffersize () = !filebuffersize
140 let get_maxuploadfilesize () = !maxuploadfilesize
141 let get_maxrequestbodysize () = !maxrequestbodysize
142 let get_default_charset () = !defaultcharset
143 let get_datadir () = !datadir
144 let get_bindir () = !bindir
145 let get_extralibdir () = !extralibdir
146 let get_user () = !user
147 let get_group () = !group
148 let get_command_pipe () = !command_pipe
149 let get_debugmode () = !debugmode
150 let get_disablepartialrequests () = !disablepartialrequests
151 let get_usedefaulthostname () = !usedefaulthostname
152 let get_respect_pipeline () = !respectpipeline
153 let get_default_port () = !default_port
154 let get_default_sslport () = !default_sslport
155 let get_maxretries () = !maxretries
156 let get_shutdown_timeout () = !shutdowntimeout
158 let display_version () =
159 print_string version_number;
160 print_newline ();
161 exit 0