Пример #1
0
        public static void Main(string[] args)
        {
            Rook.RookOptions options = new Rook.RookOptions()
            {
                labels = new Dictionary <string, string> {
                    { "env", "dev" }
                }
            };
            Rook.API.Start(options);

            // Default options
            var contentRoot = Directory.GetCurrentDirectory();
            var port        = 8000;

            // Parse arguments
            var remainingArgs = args.ToList();

            while (remainingArgs.Count > 0)
            {
                if (Directory.Exists(remainingArgs.First()))
                {
                    contentRoot = remainingArgs.First();
                }
                else if (int.TryParse(remainingArgs.First(), out int customPort))
                {
                    port = customPort;
                }
                else
                {
                    break;
                }

                remainingArgs = remainingArgs.Skip(1).ToList();
            }

            var host = new WebHostBuilder()
                       .UseUrls("http://*:" + port)
                       .UseContentRoot(contentRoot)
                       .UseKestrel()
                       .UseStartup <Startup>()
                       .Build();

            host.Run();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            Rook.RookOptions options = new Rook.RookOptions()
            {
                token  = "8e32a608b8a3d5a383f6e457022c7e27a22732130133fa0d629bbd1dcb5c5965",
                labels = new Dictionary <string, string> {
                    { "env", "dev" }
                },
                log_level     = "Trace",
                log_to_stderr = true,
                debug         = true,
                log_file      = @"C:\AppdLogs\dotnet-rook.log",
                throw_errors  = true,
                log_to_file   = true
            };
            Rook.API.Start(options);

            CreateHostBuilder(args).Build().Run();
        }