public void Configuration(IAppBuilder app) { //write defaults and stuff Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "setting default configuration..."); SelfConfig.WriteDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: antd..."); SystemConfig.WriteDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: system..."); Cfg.LaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: cfg..."); Network.LaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: network..."); SystemDataRepo.LaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: systemDataRepo..."); ZfsMount.LaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " set configuration for: zfsMount..."); Command.Launch("chmod", "777 *.xml"); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " check configuration..."); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "loading service configuration"); var hubConfiguration = new HubConfiguration { EnableDetailedErrors = false }; app.MapSignalR(hubConfiguration); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " signalR -> loaded"); bool errorTrace = false; StaticConfiguration.DisableErrorTraces = errorTrace; Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " disableerrortraces -> {0}", errorTrace); Database.Start(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " denso-db -> loaded"); app.UseNancy(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " nancy-fx -> loaded"); }
private static void Main(string[] args) { DateTime startTime = DateTime.Now; Console.Title = "ANTD"; Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "loading application..."); SystemConfig.FirstLaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "setting core system configuration..."); Cfg.FirstLaunchDefaults(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "setting core cfg configuration..."); var stop = new ManualResetEvent(false); Console.CancelKeyPress += (sender, e) => { Console.WriteLine("^C"); Database.ShutDown(); stop.Set(); e.Cancel = true; }; string uri = SelfConfig.GetAntdUri(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "initializing antd"); using (WebApp.Start <Startup>(uri)) { Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "loading service"); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " service type -> server"); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + " -> server url -> {0}", uri); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "service is now running"); var elapsed = DateTime.Now - startTime; Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "loaded in: " + elapsed); Console.WriteLine(""); ServiceUnitInfo.SetDefaultUnitInfo(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "misc -> default unit info saved to database"); UnitFile.WriteForSelf(); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "self -> unit file created"); Systemctl.Enable("antd.service"); Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "self -> unit file enabled"); //Console.WriteLine(""); //string[] watchThese = new string[] { // "/cfg", // "/proc/sys", // "/sys/class/net" //}; //foreach (string folder in watchThese) { // new DirectoryWatcher(folder).Watch(); // Console.WriteLine(ConsoleTime.GetTime(DateTime.Now) + "watcher enabled for {0}", folder); //} stop.WaitOne(); } }