Esempio n. 1
0
        /// <summary>
        /// Load the configuration from a file.
        /// </summary>
        /// <param name="filename">Filename.</param>
        /// <returns>Configuration object.</returns>
        public static DaemonSettings FromFile(string filename)
        {
            if (String.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("Unable to find " + filename);
            }
            string         contents = File.ReadAllText(filename);
            DaemonSettings ret      = Common.DeserializeJson <DaemonSettings>(contents);

            return(ret);
        }
Esempio n. 2
0
        /// <summary>
        /// Default settings.
        /// </summary>
        /// <returns>Settings.</returns>
        public static DaemonSettings Default()
        {
            DaemonSettings ret = new DaemonSettings();

            ret.Database        = new DbSettings("./data/komodo.db");
            ret.TempStorage     = new StorageSettings(new DiskSettings("./data/temp/"));
            ret.SourceDocuments = new StorageSettings(new DiskSettings("./data/source/"));
            ret.ParsedDocuments = new StorageSettings(new DiskSettings("./data/parsed/"));

            ret.Logging = new LoggingSettings();
            ret.Logging.ConsoleLogging   = false;
            ret.Logging.FileDirectory    = "./logs/";
            ret.Logging.FileLogging      = true;
            ret.Logging.Filename         = "Komodo.log";
            ret.Logging.MinimumLevel     = Severity.Debug;
            ret.Logging.SyslogServerIp   = "127.0.0.1";
            ret.Logging.SyslogServerPort = 514;

            return(ret);
        }
Esempio n. 3
0
 /// <summary>
 /// Instantiate Komodo daemon using your own settings.
 /// </summary>
 /// <param name="settings">Settings.</param>
 public KomodoDaemon(DaemonSettings settings)
 {
     _Settings = settings ?? throw new ArgumentNullException(nameof(settings));
     Initialize();
 }
Esempio n. 4
0
 /// <summary>
 /// Instantiate Komodo daemon using default settings, files, and directories.
 /// </summary>
 public KomodoDaemon()
 {
     _Settings = DaemonSettings.Default();
     Initialize();
 }