Beispiel #1
0
        /// <summary>
        /// Build an instance of <see cref="ServerOptions"/> from the information supplied on the
        /// command line by the user
        /// </summary>
        /// <param name="commandLine">Command line parameters supplied by the user.</param>
        /// <param name="options">Options for configuring validation.</param>
        /// <returns>Either a usable (and completely valid) <see cref="ServerOptions"/> or a set
        /// of errors.</returns>
        public static Errorable <ServerOptions> Build(
            ServerCommandLine commandLine,
            ServerOptionBuilderOptions options = ServerOptionBuilderOptions.None)
        {
            var builder = new ServerOptionBuilder(commandLine, options);

            return(builder.Build());
        }
Beispiel #2
0
        /// <summary>
        /// Serve mode - run as a standalone web server
        /// </summary>
        /// <param name="commandLine">Options from the command-line.</param>
        /// <returns>Exit code to return from this process.</returns>
        public static int Serve(ServerCommandLine commandLine)
        {
            var options = ServerOptionBuilder.Build(commandLine);

            return(options.Match(RunServer, LogErrors));
        }