예제 #1
0
        private ParamBlock BuildDefaultParameters()
        {
            ParamBlock ret = new ParamBlock();

            ret.Add(new ParamBlock.ParameterDefn <bool>("Quiet", "Quiet console output", false));
            ret.Add(new ParamBlock.ParameterDefn <bool>("Verbose", "Excessive console output", false));
            ret.Add(new ParamBlock.ParameterDefn <bool>("ConsoleLog", "Also log to the console", true));
            ret.Add(new ParamBlock.ParameterDefn <string>("ConfigFile", "Per site configuration file", "config.json"));

            ret.Add(new ParamBlock.ParameterDefn <string>("DefaultIceServer", "IP address of ice server. If empty, set to self.", ""));

            // NOTE: on Windows10, you must add url to acl: netsh http add urlacl url=http://+:9400/ user=everyone
            ret.Add(new ParamBlock.ParameterDefn <string>("Listener.Host", "HttpListener host", "+"));
            ret.Add(new ParamBlock.ParameterDefn <int>("Listener.Port", "HttpListener port", 9400));
            ret.Add(new ParamBlock.ParameterDefn <string>("Listener.Response.Header.Server", "What to return as 'Server: header field", "1.5"));

            ret.Add(new ParamBlock.ParameterDefn <string>("Storage.Dir", "Root of entity storage", "Entities"));
            ret.Add(new ParamBlock.ParameterDefn <string>("Storage.StaticDir", "Directory of static pages served for users", "Static"));
            ret.Add(new ParamBlock.ParameterDefn <int>("Storage.IdleMinutes", "Minutes to keep entities in memory", 60));
            ret.Add(new ParamBlock.ParameterDefn <int>("Storage.FlushMinutes", "Minutes before changed data is flushed", 1));

            ret.Add(new ParamBlock.ParameterDefn <string>("Commerce.MarketplaceKey", "Public key for Marketplace access", "lksjdlkjskldjflsd"));

            ret.Add(new ParamBlock.ParameterDefn <string>("LogLevel", "One of 'warn', 'info', 'debug'", "Debug"));
            ret.Add(new ParamBlock.ParameterDefn <int>("Logger.RotateMins", "Minutes to write to log file before starting next", 60));
            ret.Add(new ParamBlock.ParameterDefn <bool>("Logger.ForceFlush", "Force a flush after each log write", true));
            ret.Add(new ParamBlock.ParameterDefn <string>("Logger.LogDirectory", "Directory to put logs into", "Logs"));


            ret.SetParameterDefaultValues();

            return(ret);
        }
예제 #2
0
        /// <summary>
        /// Construct application wide parameters.
        /// First process the command line parameters (the highest priority),
        /// then add the default parameters. That will give us the value
        /// for the persistant parameter filename.
        /// Will throw an exception if there is an error anywhere.
        /// </summary>
        /// <param name="args">command line arguements</param>
        public AppParams(string[] args)
        {
            _defaultParameters = BuildDefaultParameters();

            // Build the command line parameters
            _commandLineParameters = new ParamBlock();
            MergeCommandLine(args, null, null);
        }
예제 #3
0
        private ParamBlock BuildDefaultParameters()
        {
            ParamBlock ret = new ParamBlock();

            ret.Add(new ParamBlock.ParameterDefn <bool>(P_QUIET, "Quiet console output", false));
            ret.Add(new ParamBlock.ParameterDefn <bool>(P_VERBOSE, "Excessive console output", false));
            ret.Add(new ParamBlock.ParameterDefn <bool>(P_CONSOLELOG, "Also log to the console", true));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_CONFIGFILE, "Per site configuration file", "config.json"));
            ret.Add(new ParamBlock.ParameterDefn <bool>(P_VERSION, "Just print out the appliction version", false));

            ret.Add(new ParamBlock.ParameterDefn <string>(P_METAVERSE_SERVER_URL, "URL for main API access. If empty, set to self", ""));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_DEFAULT_ICE_SERVER, "IP address of ice server. If empty, set to self", ""));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_METAVERSE_NAME, "Long name of the Metaverse", "Vircadia Noobie"));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_METAVERSE_NICKNAME, "Short form of the name of the Metaverse", "Noobie"));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_METAVERSE_INFO_FILE, "File of addition infor for metaverse_info request", "MetaverseInfo.json"));

            // NOTE: on Windows10, you must add url to acl: netsh http add urlacl url=http://+:9400/ user=everyone
            ret.Add(new ParamBlock.ParameterDefn <string>(P_LISTENER_HOST, "HttpListener host", "+"));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_LISTENER_PORT, "HttpListener port", 9400));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_LISTENER_RESPONSE_HEADER_SERVER, "What to return as 'Server: header field", "1.5"));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_LISTENER_CORS_PROCESSING, "CORS response header. One of 'NONE', 'ORIGIN', 'STAR'", "STAR"));

            ret.Add(new ParamBlock.ParameterDefn <string>(P_STORAGE_DIR, "Root of storage", "."));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_ENTITY_DIR, "Root of entity storage", "Entities"));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_STORAGE_STATIC_DIR, "Directory of static pages served for users", "static"));

            ret.Add(new ParamBlock.ParameterDefn <int>(P_ACCOUNT_AUTHTOKEN_LIFETIME_HOURS, "Hours that an AuthToken is allowed to live", 12));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_ACCOUNT_AUTHTOKENEXPIRATIONCHECKSECONDS, "Seconds between times checking for authtoken flushing", 60));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_ACCOUNT_USERNAME_FORMAT, "Regex for username format", @"^[0-9a-z_+-\.]+$"));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_ACCOUNT_EMAIL_FORMAT, "Regex for email format", @"^[0-9a-z_+-\.]+@[0-9a-z-\.]+$"));

            ret.Add(new ParamBlock.ParameterDefn <string>(P_DOMAIN_TOKENGEN_URL, "URL for user domain token generation", "/static/DomainTokenLogin.html"));

            ret.Add(new ParamBlock.ParameterDefn <int>(P_SESSION_IDLE_EXPIRE_SECONDS, "Time to keep idle sessions", 60 * 5));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_SESSION_IDLE_CHECK_SECONDS, "How often to check for idle sessions", 60 * 2));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_SESSION_THROTTLE_ACCOUNT_CREATE, "Account creatable per heartbeat", 2));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_SESSION_THROTTLE_TOKEN_CREATE, "Access tokens creatable per heartbeat", 2));

            ret.Add(new ParamBlock.ParameterDefn <int>(P_REQUEST_EXPIRATION_CHECK_SECONDS, "How often to check for request expiration", 60));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_CONNECTION_REQUEST_SECONDS, "Seconds that a connection_request stays active", 20));

            ret.Add(new ParamBlock.ParameterDefn <string>(P_COMMERCE_MARKETPLACEKEY, "Public key for Marketplace access", "lksjdlkjskldjflsd"));

            ret.Add(new ParamBlock.ParameterDefn <string>(P_LOGLEVEL, "One of 'warn', 'info', 'debug'", "Debug"));
            ret.Add(new ParamBlock.ParameterDefn <int>(P_LOGGER_ROTATE_MINS, "Minutes to write to log file before starting next", 24 * 60));
            ret.Add(new ParamBlock.ParameterDefn <bool>(P_LOGGER_FORCE_FLUSH, "Force a flush after each log write", true));
            ret.Add(new ParamBlock.ParameterDefn <string>(P_LOGGER_LOG_DIR, "Directory to put logs into", "Logs"));

            ret.Add(new ParamBlock.ParameterDefn <bool>(P_DEBUG_PROCESSING, "Whether to print each API request processing", false));
            ret.Add(new ParamBlock.ParameterDefn <bool>(P_DEBUG_QUERIES, "Whether to print each query request processing", false));

            ret.SetParameterDefaultValues();

            return(ret);
        }
예제 #4
0
        /// <summary>
        /// Construct application wide parameters.
        /// First process the command line parameters (the highest priority),
        /// then add the default parameters. That will give us the value
        /// for the persistant parameter filename.
        /// Will throw an exception if there is an error anywhere.
        /// </summary>
        /// <param name="args">command line arguements</param>
        public AppParams(string[] args)
        {
            _defaultParameters = BuildDefaultParameters();

            // Build the command line parameters
            _commandLineParameters = new ParamBlock();
            MergeCommandLine(args, null, null);

            _siteParameters = new ParamPersistant(this.P <string>("ConfigFile"));
            _siteParameters.SetParameterDefaultValues();
        }