24c6c12000-02-20Martin Nilsson // This file is part of Roxen Webserver. // Copyright © 1996 - 2000, Roxen IS.
b9a7022000-07-15Andreas Lange // $Id: global_variables.pike,v 1.36 2000/07/15 01:05:42 lange Exp $
e35de22000-03-10Martin Nilsson 
a59d252000-07-04Per Hedbor /*
e35de22000-03-10Martin Nilsson #pragma strict_types
a59d252000-07-04Per Hedbor */
e35de22000-03-10Martin Nilsson #define DEFVAR string,int|string,string|mapping,int,string|mapping(string:string),void|array(string),void|function:void #define BDEFVAR string,int|string,string|mapping,int,string|mapping(string:string),void|array(string),void|mapping(string:mapping(string:string)):void
24c6c12000-02-20Martin Nilsson 
690adf1999-08-30Per Hedbor #include <module.h> #include <roxen.h> #include <config.h> inherit "read_config";
3bb11d2000-07-09Per Hedbor inherit "basic_defvar";
7d2baf2000-02-02Martin Stjernholm #include <version.h>
434bac2000-07-14Andreas Lange //<locale-token project="config_interface">LOCALE</locale-token>
b9a7022000-07-15Andreas Lange static inline string GETLOCLANG() { return roxenp()->locale->get(); } #define LOCALE(X,Y) _DEF_LOCALE("config_interface",X,Y)
f498ed2000-07-11Martin Nilsson 
3bb11d2000-07-09Per Hedbor mixed save() { store( "Variables", variables, 0, 0 ); }
690adf1999-08-30Per Hedbor // The following three functions are used to hide variables when they // are not used. This makes the user-interface clearer and quite a lot // less clobbered.
f4b6251999-09-02Per Hedbor  private int cache_disabled_p() { return !QUERY(cache); } private int syslog_disabled() { return QUERY(LogA)!="syslog"; }
e35de22000-03-10Martin Nilsson private int ident_disabled_p() { return [int(0..1)]QUERY(default_ident); }
690adf1999-08-30Per Hedbor 
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange // And why put these functions here, you might righfully ask.
934b3f2000-02-04Per Hedbor  // The answer is that there is actually a reason for it, it's for // performance reasons. This file is dumped to a .o file, roxen.pike // is not. void set_up_ftp_variables( object o ) {
e35de22000-03-10Martin Nilsson  function(DEFVAR) defvar =
434bac2000-07-14Andreas Lange  [function(DEFVAR)] o->defvar;
934b3f2000-02-04Per Hedbor  defvar( "FTPWelcome", " +------------------------------------------------\n" " +-- Welcome to the Roxen FTP server ---\n" " +------------------------------------------------\n",
434bac2000-07-14Andreas Lange  LOCALE("G", "Welcome text"), TYPE_TEXT, LOCALE("H", "The text shown the the user on connect") );
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "ftp_user_session_limit", 0, LOCALE("I", "User session limit"), TYPE_INT, LOCALE("J", "The maximum number of times a user can connect at once."
f498ed2000-07-11Martin Nilsson  " 0 means unlimited.") );
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "named_ftp", 1, LOCALE("K", "Allow named ftp"), TYPE_FLAG, LOCALE("L", "If yes, non-anonymous users can connect") );
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "guest_ftp", 1, LOCALE("M", "Allow login with incorrect password/user"), TYPE_FLAG, LOCALE("N", "If yes, users can connect with the wrong password " "and/or username. This is useful since things like .htaccess " "files can later on authenticate the user."));
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "anonymous_ftp", 1, LOCALE("P", "Allow anonymous ftp"), TYPE_FLAG, LOCALE("Q", "If yes, anonymous users is allowed to connect.") );
934b3f2000-02-04Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "shells", "", LOCALE("R", "Shell database"), TYPE_FILE, LOCALE("S", "If this string is set to anything but the empty string, "
934b3f2000-02-04Per Hedbor  "it should point to a file containing a list of valid shells. " "Users with shells that does not figure in this list will not "
f498ed2000-07-11Martin Nilsson  "be allowed to log in.") );
934b3f2000-02-04Per Hedbor }
472b152000-02-08Per Hedbor void set_up_http_variables( object o, int|void fhttp )
934b3f2000-02-04Per Hedbor {
e35de22000-03-10Martin Nilsson  function(DEFVAR) defvar = [function(DEFVAR)] o->defvar;
472b152000-02-08Per Hedbor 
434bac2000-07-14Andreas Lange  defvar("show_internals", 1, LOCALE("T", "Show internal errors"), TYPE_FLAG, LOCALE("U", "Show 'Internal server error' messages to the user. "
f498ed2000-07-11Martin Nilsson  "This is very useful if you are debugging your own modules " "or writing Pike scripts."));
472b152000-02-08Per Hedbor  if(!fhttp) {
434bac2000-07-14Andreas Lange  defvar("set_cookie", 0, LOCALE("V", "Logging: Set unique user id cookies"), TYPE_FLAG, LOCALE("W", "If set to Yes, all users of your server whose clients " "support cookies will get a unique 'user-id-cookie', this " "can then be used in the log and in scripts to track " "individual users.")); defvar("set_cookie_only_once", 1, LOCALE("X", "Logging: Set ID cookies only once"),
472b152000-02-08Per Hedbor  TYPE_FLAG,
434bac2000-07-14Andreas Lange  LOCALE("Y", "If set to Yes, Roxen will attempt to set unique user " "ID cookies only upon receiving the first request (and " "again after some minutes). Thus, if the user doesn't allow " "the cookie to be set, she won't be bothered with "
f498ed2000-07-11Martin Nilsson  "multiple requests."),0 ,
e35de22000-03-10Martin Nilsson  lambda() {return !QUERY(set_cookie);});
472b152000-02-08Per Hedbor  } } void set_up_fhttp_variables( object o ) {
e35de22000-03-10Martin Nilsson  function(BDEFVAR) defvar = [function(BDEFVAR)] o->defvar;
434bac2000-07-14Andreas Lange  defvar( "log", "None", LOCALE("Z", "Logging method"), TYPE_STRING_LIST, LOCALE("0", "None - No log<br />" "CommonLog - A common log in a file<br />" "Compat - Log through roxen's normal logging format.<br />" "<p>Please note that compat limits roxen to less than 1k " "requests/second.</p>"), ({ "None", "CommonLog", "Compat" }));
472b152000-02-08Per Hedbor 
0c67592000-03-13Per Hedbor  defvar( "log_file", "$LOGDIR/clog-"+[string]o->ip+":"+[string]o->port,
434bac2000-07-14Andreas Lange  LOCALE("1", "Log file"), TYPE_FILE, LOCALE("2", "This file is used if logging is done using the " "CommonLog method.")); defvar( "ram_cache", 20, LOCALE("3", "Ram cache"), TYPE_INT, LOCALE("4", "The size of the ram cache, in MegaBytes"));
472b152000-02-08Per Hedbor 
434bac2000-07-14Andreas Lange  defvar( "read_timeout", 120, LOCALE("5", "Client timeout"), TYPE_INT, LOCALE("6", "The maximum time roxen will wait for a client " "before giving up, and close the connection, in seconds"));
472b152000-02-08Per Hedbor  set_up_http_variables( o,1 ); } void set_up_ssl_variables( object o ) {
e35de22000-03-10Martin Nilsson  function(DEFVAR) defvar = [function(DEFVAR)] o->defvar;
472b152000-02-08Per Hedbor  defvar( "ssl_cert_file", "demo_certificate.pem",
434bac2000-07-14Andreas Lange  LOCALE("7", "SSL certificate file"), TYPE_STRING, sprintf(LOCALE("8", "The SSL certificate file to use. The path " "is relative to %s\n"), getcwd() )); defvar( "ssl_key_file", "", LOCALE("9", "SSL key file"), TYPE_STRING, sprintf(LOCALE("aa", "The SSL key file to use. The path is " "relative to %s, you do not have to specify a key " "file, leave this field empty to use the certificate " "file only\n"), getcwd() ));
934b3f2000-02-04Per Hedbor }
f4b6251999-09-02Per Hedbor // Get the current domain. This is not as easy as one could think. string get_domain(int|void l) { array f; string t, s;
c5e0961999-10-04Per Hedbor  // FIXME: NT support.
f4b6251999-09-02Per Hedbor 
c5e0961999-10-04Per Hedbor  t = Stdio.read_bytes("/etc/resolv.conf");
5ffd492000-02-02Per Hedbor  if(t)
c5e0961999-10-04Per Hedbor  { if(!sscanf(t, "domain %s\n", s)) if(!sscanf(t, "search %s%*[ \t\n]", s)) s="nowhere"; } else { s="nowhere";
f4b6251999-09-02Per Hedbor  }
c5e0961999-10-04Per Hedbor  s = "host."+s;
f4b6251999-09-02Per Hedbor  sscanf(s, "%*s.%s", s); if(s && strlen(s)) { if(s[-1] == '.') s=s[..strlen(s)-2]; if(s[0] == '.') s=s[1..]; } else {
5ffd492000-02-02Per Hedbor  s="unknown";
f4b6251999-09-02Per Hedbor  } return s; }
a59d252000-07-04Per Hedbor class PortOptions { inherit Variable.Variable; constant type = "PortOptions"; int check_visibility(object id, int a, int b, int c, int d) { return 0; } void set_from_form(object id ) { return; } void create() { ::create( ([]), 0, 0, 0 ); } };
3bb11d2000-07-09Per Hedbor void define_global_variables( )
690adf1999-08-30Per Hedbor { int p;
a59d252000-07-04Per Hedbor  defvar("port_options", PortOptions()); defvar("RestoreConnLogFull", 0,
434bac2000-07-14Andreas Lange  LOCALE("ab", "Logging: Log entire file length in restored connections"), TYPE_FLAG, LOCALE("ac", "If this toggle is enabled log entries for restored connections "
690adf1999-08-30Per Hedbor  "will log the amount of sent data plus the restoration location. " "Ie if a user has downloaded 100 bytes of a file already, and makes " "a Range request fetching the remaining 900 bytes, the log entry " "will log it as if the entire 1000 bytes were downloaded. " "<p>This is useful if you want to know if downloads were successful " "(the user has the complete file downloaded). The drawback is that " "bandwidth statistics on the log file will be incorrect. The "
f498ed2000-07-11Martin Nilsson  "statistics in Roxen will continue being correct."));
e6f83d2000-03-06Peter Bortas 
434bac2000-07-14Andreas Lange  defvar("default_font", "franklin_gothic_demi", LOCALE("ad", "Default font"), TYPE_FONT, LOCALE("ae", "The default font to use when modules request a font."));
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("font_dirs", ({"../local/nfonts/", "nfonts/" }),
434bac2000-07-14Andreas Lange  LOCALE("af", "Font directories"), TYPE_DIR_LIST, LOCALE("ag", "This is where the fonts are located."));
690adf1999-08-30Per Hedbor 
434bac2000-07-14Andreas Lange  defvar("logdirprefix", "../logs/", LOCALE("ah", "Logging: Log directory prefix"), TYPE_STRING|VAR_MORE, LOCALE("ai", "This is the default file path that will be prepended " "to the log file path in all the default modules and the " "virtual server."));
f498ed2000-07-11Martin Nilsson 
434bac2000-07-14Andreas Lange  defvar("cache", 0, LOCALE("aj", "Cache: Proxy Disk Cache Enabled"), TYPE_FLAG, LOCALE("ak", "If set to Yes, caching will be enabled."));
f498ed2000-07-11Martin Nilsson 
b9a7022000-07-15Andreas Lange  defvar("garb_min_garb", 1, LOCALE("am", "Cache: Proxy Disk Cache Clean size"),
434bac2000-07-14Andreas Lange  TYPE_INT, LOCALE("an", "Minimum number of Megabytes removed when a garbage collect is done."),
690adf1999-08-30Per Hedbor  0, cache_disabled_p);
f498ed2000-07-11Martin Nilsson 
b9a7022000-07-15Andreas Lange  defvar("cache_minimum_left", 5,
434bac2000-07-14Andreas Lange  LOCALE("ao", "Cache: Proxy Disk Cache Minimum available free space and inodes (in %)"), TYPE_INT, LOCALE("ap", "If less than this amount of disk space or inodes (in %) " "is left, the cache will remove a few files. This check may " "work half-hearted if the diskcache is spread over several " "filesystems."),
f498ed2000-07-11Martin Nilsson  0,
690adf1999-08-30Per Hedbor #if constant(filesystem_stat)
f498ed2000-07-11Martin Nilsson  cache_disabled_p
690adf1999-08-30Per Hedbor #else
f498ed2000-07-11Martin Nilsson  1
690adf1999-08-30Per Hedbor #endif /* filesystem_stat */
f498ed2000-07-11Martin Nilsson  );
434bac2000-07-14Andreas Lange  defvar("cache_size", 25, LOCALE("aq", "Cache: Proxy Disk Cache Size"), TYPE_INT, LOCALE("ar", "How many MB may the cache grow to before a garbage " "collect is done?"), 0, cache_disabled_p);
b9a7022000-07-15Andreas Lange  defvar("cache_max_num_files", 0,
434bac2000-07-14Andreas Lange  LOCALE("as", "Cache: Proxy Disk Cache Maximum number of files"), TYPE_INT, LOCALE("at", "How many cache files (inodes) may be on disk before " "a garbage collect is done ? May be left zero to disable " "this check."), 0, cache_disabled_p);
b9a7022000-07-15Andreas Lange  defvar("bytes_per_second", 50,
434bac2000-07-14Andreas Lange  LOCALE("au", "Cache: Proxy Disk Cache bytes per second"), TYPE_INT, LOCALE("av", "How file size should be treated during garbage collect. " "Each X bytes counts as a second, so that larger files will " "be removed first."),
690adf1999-08-30Per Hedbor  0, cache_disabled_p);
a59d252000-07-04Per Hedbor  defvar("cachedir", "/tmp/roxen_cache/",
434bac2000-07-14Andreas Lange  LOCALE("aw", "Cache: Proxy Disk Cache Base Cache Dir"),
690adf1999-08-30Per Hedbor  TYPE_DIR,
434bac2000-07-14Andreas Lange  LOCALE("ax", "This is the base directory where cached files will " "reside. To avoid mishaps, 'roxen_cache/' is always " "prepended to this variable."), 0, cache_disabled_p);
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("hash_num_dirs", 500,
434bac2000-07-14Andreas Lange  LOCALE("ay", "Cache: Proxy Disk Cache Number of hash directories"), TYPE_INT|VAR_MORE, LOCALE("az", "This is the number of directories to hash the contents " "of the disk cache into. Changing this value currently " "invalidates the whole cache, since the cache cannot find " "the old files. In the future, the cache will be " "recalculated when this value is changed."), 0, cache_disabled_p);
b9a7022000-07-15Andreas Lange  defvar("cache_keep_without_content_length", 1,
434bac2000-07-14Andreas Lange  LOCALE("aA", "Cache: Proxy Disk Cache Keep without Content-Length"), TYPE_FLAG, LOCALE("aB", "Keep files without Content-Length header information " "in the cache?"), 0, cache_disabled_p);
b9a7022000-07-15Andreas Lange  defvar("cache_check_last_modified", 0,
434bac2000-07-14Andreas Lange  LOCALE("aC", "Cache: Proxy Disk Cache Refreshes on Last-Modified"), TYPE_FLAG, LOCALE("aD", "If set, refreshes files without Expire header " "information when they have reached double the age they had " "when they got cached. This may be useful for some regularly " "updated docs as online newspapers."), 0, cache_disabled_p);
b9a7022000-07-15Andreas Lange  defvar("cache_last_resort", 0,
434bac2000-07-14Andreas Lange  LOCALE("aE", "Cache: Proxy Disk Cache Last resort (in days)"), TYPE_INT, LOCALE("aF", "How many days shall files without Expires and without " "Last-Modified header information be kept?"), 0, cache_disabled_p);
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("cache_gc_logfile", "",
434bac2000-07-14Andreas Lange  LOCALE("aG", "Cache: Proxy Disk Cache Garbage collector logfile"), TYPE_FILE, LOCALE("aH", "Information about garbage collector runs, removed and " "refreshed files, cache and disk status goes here."), 0, cache_disabled_p);
690adf1999-08-30Per Hedbor  /// End of cache variables..
434bac2000-07-14Andreas Lange  defvar("pidfile", "/tmp/roxen_pid_$uid", LOCALE("aI", "PID file"), TYPE_FILE|VAR_MORE, LOCALE("aJ", "In this file, the server will write out it's PID, and " "the PID of the start script. $pid will be replaced with the " "pid, and $uid with the uid of the user running the process.\n" "<p>Note: It will be overridden by the command line option.</p>"));
f498ed2000-07-11Martin Nilsson  // FIXME: Should mention real_version.
434bac2000-07-14Andreas Lange  defvar("default_ident", 1, LOCALE("aK", "Identify, Use default identification string"), TYPE_FLAG|VAR_MORE, LOCALE("aL", "Setting this variable to No will display " "the \"Identify as\" node where you can state what Roxen " "should call itself when talking to clients.<br />"
690adf1999-08-30Per Hedbor  "It is possible to disable this so that you can enter an " "identification-string that does not include the actual version of " "Roxen, as recommended by the HTTP/1.0 draft 03:<p><blockquote><i>" "Note: Revealing the specific software version of the server " "may allow the server machine to become more vulnerable to " "attacks against software that is known to contain security " "holes. Server implementors are encouraged to make this field "
f498ed2000-07-11Martin Nilsson  "a configurable option.</i></blockquote></p>"));
434bac2000-07-14Andreas Lange  defvar("ident", replace(real_version," ","·"), LOCALE("aM", "Identify, Identify as"), TYPE_STRING /* |VAR_MORE */, LOCALE("aN", "Enter the name that Roxen should use when talking to clients. "), 0, ident_disabled_p); defvar("User", "", LOCALE("aP", "Change uid and gid to"), TYPE_STRING, LOCALE("aQ", "When roxen is run as root, to be able to open port 80 " "for listening, change to this user-id and group-id when the " "port has been opened. If you specify a symbolic username, " "the default group of that user will be used. " "The syntax is user[:group].")); defvar("permanent_uid", 0, LOCALE("aR", "Change uid and gid permanently"), TYPE_FLAG, LOCALE("aS", "If this variable is set, roxen will set it's uid and gid "
690adf1999-08-30Per Hedbor  "permanently. This disables the 'exec script as user' fetures " "for CGI, and also access files as user in the filesystems, but "
f498ed2000-07-11Martin Nilsson  "it gives better security."));
690adf1999-08-30Per Hedbor 
f498ed2000-07-11Martin Nilsson  // FIXME: Should mention getcwd()
a59d252000-07-04Per Hedbor  defvar("ModuleDirs", ({ "../local/modules/", "modules/" }),
434bac2000-07-14Andreas Lange  LOCALE("aT", "Module directories"), TYPE_DIR_LIST, LOCALE("aU", "This is a list of directories where Roxen should look " "for modules. Can be relative paths, from the " "directory you started roxen. " "The directories are searched in order for modules."));
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("Supports", "#include <etc/supports>\n",
434bac2000-07-14Andreas Lange  LOCALE("aV", "Client supports regexps"), TYPE_TEXT_FIELD|VAR_MORE, LOCALE("aW", "What do the different clients support?\n<br />"
f498ed2000-07-11Martin Nilsson  "The default information is normally fetched from the file " "server/etc/supports in your roxen directory."));
434bac2000-07-14Andreas Lange  defvar("audit", 0, LOCALE("aX", "Logging: Audit trail"), TYPE_FLAG, LOCALE("aY", "If Audit trail is set to Yes, all changes of uid will be " "logged in the Event log."));
690adf1999-08-30Per Hedbor 
5ffd492000-02-02Per Hedbor #if efun(syslog)
434bac2000-07-14Andreas Lange  defvar("LogA", "file", LOCALE("aZ", "Logging: Logging method"), TYPE_STRING_LIST|VAR_MORE, LOCALE("a0", "What method to use for logging, default is file, but "
690adf1999-08-30Per Hedbor  "syslog is also available. When using file, the output is really" " sent to stdout and stderr, but this is handled by the "
f498ed2000-07-11Martin Nilsson  "start script."),
434bac2000-07-14Andreas Lange  ({ "file", "syslog" }));
f498ed2000-07-11Martin Nilsson 
434bac2000-07-14Andreas Lange  defvar("LogSP", 1, LOCALE("a1", "Logging: Log PID"), TYPE_FLAG, LOCALE("a2", "If set, the PID will be included in the syslog."), 0, syslog_disabled);
f498ed2000-07-11Martin Nilsson 
434bac2000-07-14Andreas Lange  defvar("LogCO", 0, LOCALE("a3", "Logging: Log to system console"), TYPE_FLAG, LOCALE("a4", "If set and syslog is used, the error/debug message " "will be printed to the system console as well as to the " "system log."),
690adf1999-08-30Per Hedbor  0, syslog_disabled);
f498ed2000-07-11Martin Nilsson 
434bac2000-07-14Andreas Lange  defvar("LogST", "Daemon", LOCALE("a5", "Logging: Syslog type"), TYPE_STRING_LIST, LOCALE("a6", "When using SYSLOG, which log type should be used."), ({ "Daemon", "Local 0", "Local 1", "Local 2", "Local 3", "Local 4", "Local 5", "Local 6", "Local 7", "User" }), syslog_disabled); defvar("LogWH", "Errors", LOCALE("a7", "Logging: Log what to syslog"), TYPE_STRING_LIST, LOCALE("a8", "When syslog is used, how much should be sent to it?<br /><hr />" "Fatal: Only messages about fatal errors<br />" "Errors: Only error or fatal messages<br />" "Warning: Warning messages as well<br />" "Debug: Debug messager as well<br />" "All: Everything<br />"), ({ "Fatal", "Errors", "Warnings", "Debug", "All" }), syslog_disabled); defvar("LogNA", "Roxen", LOCALE("a9", "Logging: Log as"), TYPE_STRING, LOCALE("ba", "When syslog is used, this will be the identification " "of the Roxen daemon. The entered value will be appended to " "all logs."), 0, syslog_disabled);
690adf1999-08-30Per Hedbor #endif #ifdef THREADS
434bac2000-07-14Andreas Lange  defvar("numthreads", 5, LOCALE("bb", "Number of threads to run"), TYPE_INT, LOCALE("bc", "The number of simultaneous threads roxen will use.\n"
690adf1999-08-30Per Hedbor  "<p>Please note that even if this is one, Roxen will still " "be able to serve multiple requests, using a select loop based " "system.\n" "<i>This is quite useful if you have more than one CPU in "
f498ed2000-07-11Martin Nilsson  "your machine, or if you have a lot of slow NFS accesses.</i></p>"));
690adf1999-08-30Per Hedbor #endif
5ffd492000-02-02Per Hedbor 
434bac2000-07-14Andreas Lange  defvar("AutoUpdate", 1, LOCALE("bd", "Update the supports database automatically"), TYPE_FLAG, LOCALE("be", "If set to Yes, the etc/supports file will be updated " "automatically from www.roxen.com now and then. This is " "recomended, since you will then automatically get supports " "information for new clients, and new versions of old ones."));
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("next_supports_update", time()+3600, "", TYPE_INT,"",0,1);
690adf1999-08-30Per Hedbor 
5627f12000-04-13Per Hedbor #ifndef __NT__
434bac2000-07-14Andreas Lange  defvar("abs_engage", 0, LOCALE("bf", "ABS: Enable Anti-Block-System"), TYPE_FLAG|VAR_MORE, LOCALE("bg", "If set, the anti-block-system will be enabled. "
f498ed2000-07-11Martin Nilsson  "This will restart the server after a configurable number of minutes if it " "locks up. If you are running in a single threaded environment heavy " "calculations will also halt the server. In multi-threaded mode bugs such as " "eternal loops will not cause the server to reboot, since only one thread is " "blocked. In general there is no harm in having this option enabled. "));
434bac2000-07-14Andreas Lange  defvar("abs_timeout", 5, LOCALE("bh", "ABS: Timeout"), TYPE_INT_LIST|VAR_MORE, LOCALE("bi", "If the server is unable to accept connection for this many "
f498ed2000-07-11Martin Nilsson  "minutes, it will be restarted. You need to find a balance: " "if set too low, the server will be restarted even if it's doing " "legal things (like generating many images), if set too high you might " "get a long downtime if the server for some reason locks up."), ({1,2,3,4,5,10,15}), lambda() {return !QUERY(abs_engage);});
5627f12000-04-13Per Hedbor #endif
690adf1999-08-30Per Hedbor 
1699fe2000-07-11Martin Nilsson 
434bac2000-07-14Andreas Lange  defvar("locale", "standard", LOCALE("bj", "Default language"), TYPE_STRING_LIST, LOCALE("bk", "Locale, used to localize all messages in roxen.\n" "Standard means using the default locale, which varies " "according to the value of the 'LANG' environment variable."),
1699fe2000-07-11Martin Nilsson #if constant(Locale.list_languages)
434bac2000-07-14Andreas Lange  sort(Locale.list_languages("config_interface")+({"standard"}))
1699fe2000-07-11Martin Nilsson #else
434bac2000-07-14Andreas Lange  sort(RoxenLocale.list_languages("config_interface")+({"standard"}))
1699fe2000-07-11Martin Nilsson #endif );
f498ed2000-07-11Martin Nilsson  defvar("suicide_engage", 0,
434bac2000-07-14Andreas Lange  LOCALE("bm", "Auto Restart: Enable Automatic Restart"),
f498ed2000-07-11Martin Nilsson  TYPE_FLAG|VAR_MORE,
434bac2000-07-14Andreas Lange  LOCALE("bn", "If set, Roxen will automatically restart after a " "configurable number of days. Since Roxen uses a monolith, " "non-forking server model the process tends to grow in size " "over time. This is mainly due to heap fragmentation but also "
f498ed2000-07-11Martin Nilsson  "because of memory leaks.")
690adf1999-08-30Per Hedbor  );
f498ed2000-07-11Martin Nilsson  defvar("suicide_timeout", 7,
434bac2000-07-14Andreas Lange  LOCALE("bo", "Auto Restart: Timeout"), TYPE_INT_LIST|VAR_MORE, LOCALE("bp", "Automatically restart the server after this many days."), ({1,2,3,4,5,6,7,14,30}), lambda(){return !QUERY(suicide_engage);});
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("argument_cache_in_db", 0,
434bac2000-07-14Andreas Lange  LOCALE("bq", "Cache: Store the argument cache in a mysql database"),
690adf1999-08-30Per Hedbor  TYPE_FLAG|VAR_MORE,
434bac2000-07-14Andreas Lange  LOCALE("br", "If set, store the argument cache in a mysql " "database. This is very useful for load balancing using multiple "
690adf1999-08-30Per Hedbor  "roxen servers, since the mysql database will handle "
f498ed2000-07-11Martin Nilsson  " synchronization"));
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("argument_cache_db_path", "mysql://localhost/roxen",
434bac2000-07-14Andreas Lange  LOCALE("bs", "Cache: Argument Cache Database URL to use"),
f498ed2000-07-11Martin Nilsson  TYPE_STRING|VAR_MORE,
434bac2000-07-14Andreas Lange  LOCALE("bt", "The database to use to store the argument cache"),
f498ed2000-07-11Martin Nilsson  0, lambda(){ return !QUERY(argument_cache_in_db); });
690adf1999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("argument_cache_dir", "$VARDIR/cache/",
434bac2000-07-14Andreas Lange  LOCALE("bu", "Cache: Argument Cache Directory"),
f498ed2000-07-11Martin Nilsson  TYPE_DIR|VAR_MORE,
434bac2000-07-14Andreas Lange  LOCALE("bv", "The cache directory to use to store the argument cache." " Please note that load balancing is not available for most modules "
f498ed2000-07-11Martin Nilsson  " (such as gtext, diagram etc) unless you use a mysql database to " "store the argument cache meta data"));
9d72c41999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("mem_cache_gc", 300,
434bac2000-07-14Andreas Lange  LOCALE("bw", "Cache: Memory Cache Garbage Collect Interval"),
f498ed2000-07-11Martin Nilsson  TYPE_INT,
434bac2000-07-14Andreas Lange  LOCALE("bx", "The number of seconds between every garbage collect "
f498ed2000-07-11Martin Nilsson  "(removal of old content) from the memory cache. The " "memory cache is used for various tasks like remebering " "what supports flags matches what client."));
9d72c41999-08-30Per Hedbor 
a59d252000-07-04Per Hedbor  defvar("config_file_comments", 0,
434bac2000-07-14Andreas Lange  LOCALE("by", "Commented config files"),
f498ed2000-07-11Martin Nilsson  TYPE_FLAG,
434bac2000-07-14Andreas Lange  LOCALE("bz", "Save the variable documentation strings as comments " "in the configuration files. Only useful if you read or " "edit the config files directly."));
690adf1999-08-30Per Hedbor }
f4b6251999-09-02Per Hedbor 
3bb11d2000-07-09Per Hedbor void restore_global_variables() { setvars(retrieve("Variables", 0)); }
e35de22000-03-10Martin Nilsson static mapping(string:mixed) __vars = ([ ]);
f4b6251999-09-02Per Hedbor  // These two should be documented somewhere. They are to be used to
c5e0961999-10-04Per Hedbor // set global, but non-persistent, variables in Roxen.
f4b6251999-09-02Per Hedbor mixed set_var(string var, mixed to) { return __vars[var] = to; } mixed query_var(string var) { return __vars[var]; }