Exemple #1
0
def main():
    args = AppArgParser().parse_args()
    app_logger = LogConfigurator(args.loglevel, args.logfile)  # pylint: disable=W0612
    if args.logfile:
        logdir = os.path.dirname(os.path.realpath(args.logfile))
        os.environ['SEAFEVENTS_LOG_DIR'] = logdir

    os.environ['EVENTS_CONFIG_FILE'] = os.path.expanduser(args.config_file)

    if args.pidfile:
        write_pidfile(args.pidfile)

    config = get_config(args.config_file)
    init_message_handlers()

    if is_syslog_enabled(config):
        app_logger.add_syslog_handler()

    events_listener_enabled = True

    app = App(get_ccnet_dir(),
              args,
              events_listener_enabled=events_listener_enabled)

    app.serve_forever()
Exemple #2
0
def load_config(config_file):
    # seafevent config file
    appconfig.session_cls = init_db_session_class(config_file)
    config = get_config(config_file)

    load_env_config()
    load_file_history_config(config)
Exemple #3
0
    def __init__(self, config_file):
        self._enabled = False
        self._interval = None
        self._config_file = config_file
        self._logfile = None
        self._timer = None

        config = get_config(config_file)
        self._parse_config(config)
Exemple #4
0
def load_config(config_file):
    config = get_config(config_file)
    load_content_scan_config(config)
    if not appconfig.enabled_scan:
        do_exit(0)

    load_env_config()
    appconfig.session_cls = init_db_session_class(config_file)
    appconfig.seaf_session_cls = init_db_session_class(
        appconfig.seaf_conf_path, db='seafile')
Exemple #5
0
def load_config(config_file):
    # seafevent config file
    appconfig.session_cls = init_db_session_class(config_file)
    config = get_config(config_file)

    load_env_config()
    appconfig.seaf_session_cls = init_db_session_class(
        appconfig.seaf_conf_path, db='seafile')
    load_publish_config(config)
    load_statistics_config(config)
    load_file_history_config(config)
    load_collab_server_config(config)
Exemple #6
0
    def __init__(self, config_file):

        self._app_config = get_config(config_file)

        self._index_updater = IndexUpdater(self._app_config)
        self._seahub_email_sender = SeahubEmailSender(self._app_config)
        self._ldap_syncer = LdapSyncer()
        self._virus_scanner = VirusScanner(os.environ['EVENTS_CONFIG_FILE'])
        self._statistics = Statistics()
        self._content_scanner = ContentScanner(config_file)
        self._work_weixin_notice_sender = WorkWinxinNoticeSender(self._app_config)
        self._file_updates_sender = FileUpdatesSender()

        self._office_converter = None
        if has_office_tools():
            self._office_converter = OfficeConverter(get_office_converter_conf(self._app_config))
Exemple #7
0
    def __init__(self, config_file):

        self._app_config = get_config(config_file)

        self._index_updater = IndexUpdater(self._app_config)
        self._seahub_email_sender = SeahubEmailSender(self._app_config)
        self._ldap_syncer = LdapSyncer()
        self._virus_scanner = VirusScanner(config_file)
        self._statistics = Statistics()
        self._content_scanner = ContentScanner(config_file)
        self._work_weixin_notice_sender = WorkWinxinNoticeSender(
            self._app_config)
        self._file_updates_sender = FileUpdatesSender()

        self._office_converter = None
        if has_office_tools():
            self._office_converter = OfficeConverter(
                get_office_converter_conf(self._app_config))

        # KEEPER
        self._keeper_archiving = KeeperArchiving(
            get_keeper_archiving_conf(self._app_config))
Exemple #8
0
def main(background_tasks_only=False):
    args = AppArgParser().parse_args()
    app_logger = LogConfigurator(args.loglevel, args.logfile)  # pylint: disable=W0612
    if args.logfile:
        logdir = os.path.dirname(os.path.realpath(args.logfile))
        os.environ['SEAFEVENTS_LOG_DIR'] = logdir

    os.environ['EVENTS_CONFIG_FILE'] = os.path.expanduser(args.config_file)

    if args.pidfile:
        write_pidfile(args.pidfile)

    create_db_tables()
    config = get_config(args.config_file)
    enable_audit = is_audit_enabled(config)
    init_message_handlers(enable_audit)

    if is_syslog_enabled(config):
        app_logger.add_syslog_handler()

    events_listener_enabled = True
    background_tasks_enabled = True

    if background_tasks_only:
        events_listener_enabled = False
        background_tasks_enabled = True
    elif is_cluster_enabled():
        events_listener_enabled = True
        background_tasks_enabled = False

    app = App(get_ccnet_dir(),
              args,
              events_listener_enabled=events_listener_enabled,
              background_tasks_enabled=background_tasks_enabled)

    app.serve_forever()
Exemple #9
0
    parser = argparse.ArgumentParser()
    parser.add_argument('-c',
                        '--config-file',
                        default=os.path.join(os.path.abspath('..'),
                                             'events.conf'),
                        help='seafevents config file path')
    parser.add_argument('--is-processing', action='store_true')
    parser.add_argument('-ls', '--list-tasks', action='store_true')
    parser.add_argument('-r',
                        '--restart',
                        help='restart archiving task(s)',
                        nargs='+')

    args = parser.parse_args()

    cfg = get_config(args.config_file)
    cfg = get_keeper_archiving_conf(cfg)

    if not cfg[_cfg.key_enabled]:
        print('Keeper Archiving is disabled.')
        exit(0)

    try:
        db = DBOper()
    except Exception as e:
        print('Cannot init DB: {}'.format(e))
        exit(1)

    # IS PROCESSING
    if args.is_processing:
        try: