コード例 #1
0
        static void Main(string[] args)
        {
            //Get the config path, otherwise launch in CLI mode
            if (args.Length != 1)
            {
                new DeltaCLI().Run();
                return;
            }

            //Open config file
            cfg = DeltaConfig.OpenConfig(args[0]);

            //Init delta
            delta = new DeltaConnection(-1, -1, APP_VERSION_MAJOR, APP_VERSION_MINOR, DeltaCoreNetServerType.MASTER_CONTROL);
            delta.InitOffline(cfg.GetRemoteConfig(), new int[0]);

            //Init others
            admin_sessions = new List <AdminSession>();
            servers        = new List <DeltaManagerServer>();
            foreach (var s in cfg.registered_servers)
            {
                servers.Add(new DeltaManagerServer(s));
            }

            //Init underlying server
            server = new MasterControlServer(delta, new IPEndPoint(IPAddress.Any, cfg.general.public_serving_port));

            //Init web interface server
            web_interface = new DeltaWebServer(delta, cfg.general.admin_interface_port);
            web_interface.AddService(new LoginDefinition());
            web_interface.AddService(new MachineListDefinition());
            web_interface.AddService(new MachineEnrollDefinition());
            web_interface.AddService(new MachineStatusDefinition());
            web_interface.AddService(new MachineAddPackageDefinition());
            web_interface.AddService(new MachineAddVersionDefinition());
            web_interface.AddService(new MachineAddInstanceDefinition());
            web_interface.AddService(new MachineUpdateInstanceDefinition());
            web_interface.AddService(new MachineDestroyInstanceDefinition());
            web_interface.AddService(new MachineDeleteVersionDefinition());
            web_interface.AddService(new MachineAddSiteDefinition());
            web_interface.AddService(new MachineAssignSiteDefinition());
            web_interface.AddService(new MachineRebootInstanceDefinition());
            web_interface.AddService(new MachinePingInstanceDefinition());
            web_interface.AddService(new MachineInstanceManageDefinition());

            //Run
            web_interface.RunAsync().GetAwaiter().GetResult();
        }
コード例 #2
0
        private void CmdLoadConfig()
        {
            //Prompt install location
            string installPath = CLITools.PromptFormTextInput("Load Config - Specify Path", "Type the filename to load.");

            //Verify
            if (!File.Exists(installPath))
            {
                CLITools.PrintText("ERROR: The file path you specified already exists.", ConsoleColor.Red);
                return;
            }

            //Load
            cfg     = DeltaConfig.OpenConfig(installPath);
            unsaved = false;

            //Write ack
            CLITools.PrintText("Configuration was successfully loaded.", ConsoleColor.Green);
        }