1 // 2 // ConfigurationManager.cs: Generic multi-source configuration manager. 3 // 4 // Author: 5 // Leonardo Taglialegne <leonardo.taglialene@gmail.com> 6 // 7 // Copyright (C) 2013 Leonardo Taglialegne 8 // 9 // Permission is hereby granted, free of charge, to any person obtaining 10 // a copy of this software and associated documentation files (the 11 // "Software"), to deal in the Software without restriction, including 12 // without limitation the rights to use, copy, modify, merge, publish, 13 // distribute, sublicense, and/or sell copies of the Software, and to 14 // permit persons to whom the Software is furnished to do so, subject to 15 // the following conditions: 16 // 17 // The above copyright notice and this permission notice shall be 18 // included in all copies or substantial portions of the Software. 19 // 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 // 28 29 using Mono.WebServer.Options.Settings; 30 using Mono.WebServer.Options; 31 32 namespace Mono.WebServer.FastCgi { 33 public partial class ConfigurationManager 34 { ConfigurationManager(string name)35 public ConfigurationManager (string name) : base (name) 36 { 37 Add(stoppable, multiplex, onDemand, 38 maxConns, maxReqs, port, idleTime, 39 filename, socket, onDemandSock); 40 } 41 42 #region Backing fields 43 readonly BoolSetting stoppable = new BoolSetting ("stoppable", Descriptions.Stoppable); 44 readonly BoolSetting multiplex = new BoolSetting ("multiplex", "Allows multiple requests to be send over a single connection.", 45 "FastCgiMultiplexConnections", "MONO_FCGI_MULTIPLEX"); 46 readonly BoolSetting onDemand = new BoolSetting ("ondemand", "Listen on the socket specified via /ondemandsock and accepts via sendmsg(2). Terminates after it receives no requests for some time"); 47 48 readonly UInt16Setting maxConns = new UInt16Setting ("maxconns", Descriptions.MaxConns, 49 "FastCgiMaxConnections", "MONO_FCGI_MAXCONNS", 1024); 50 readonly UInt16Setting maxReqs = new UInt16Setting ("maxreqs", "Specifies the maximum number of concurrent requests the server should accept.", 51 "FastCgiMaxRequests", "MONO_FCGI_MAXREQS", 1024); 52 readonly UInt16Setting port = new UInt16Setting ("port", Descriptions.Port, "MonoServerPort", "MONO_FCGI_PORT", 9000); 53 readonly UInt16Setting idleTime = new UInt16Setting ("idle-time", "Time to wait (in seconds) before stopping if --ondemand is set", defaultValue: 60); 54 55 readonly StringSetting filename = new StringSetting ("filename", "Specifies a unix socket filename to listen on.\n" + 56 "To use this argument, \"socket\" must be set to \"unix\".", "MonoUnixSocket", "MONO_FCGI_FILENAME", "/tmp/fastcgi-mono-server"); 57 readonly StringSetting socket = new StringSetting ("socket", Descriptions.Socket, "MonoSocketType", "MONO_FCGI_SOCKET", "pipe"); 58 readonly StringSetting onDemandSock = new StringSetting ("ondemandsock", "The socket to listen on for ondemand service"); 59 #endregion 60 61 #region Typesafe properties 62 public bool Stoppable { 63 get { return stoppable; } 64 } 65 public bool Multiplex { 66 get { return multiplex; } 67 } 68 public bool OnDemand { 69 get { return onDemand; } 70 } 71 72 public ushort MaxConns { 73 get { return maxConns; } 74 } 75 public ushort MaxReqs { 76 get { return maxReqs; } 77 } 78 public ushort Port { 79 get { return port; } 80 } 81 public ushort IdleTime { 82 get { return idleTime; } 83 } 84 85 public string Filename { 86 get { return filename; } 87 } 88 public string Socket { 89 get { return socket; } 90 } 91 public string OnDemandSock { 92 get { return onDemandSock; } 93 } 94 95 /* 96 * <Setting Name="automappaths" AppSetting="MonoAutomapPaths" 97 * Environment="MONO_FCGI_AUTOMAPPATHS" Type="Bool" ConsoleVisible="True" Value="False"> 98 * <Description> 99 * <para>Automatically registers applications as they are 100 * encountered, provided pages exist in standard 101 * locations.</para> 102 * </Description> 103 * </Setting> 104 */ 105 #endregion 106 107 public override string ProgramName { 108 get { return "mono-fastcgi"; } 109 } 110 111 public override string Description { 112 get { return "A FastCgi interface for ASP.NET applications."; } 113 } 114 } 115 } 116