bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#include "lib.h"
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#include "buffer.h"
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#include "settings-parser.h"
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#include "service-settings.h"
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#include "replicator-settings.h"
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen/* <settings checks> */
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenstatic struct file_listener_settings replicator_unix_listeners_array[] = {
99a9e14caaf54d884dac6a520111cfc8849d8323Timo Sirainen { "replicator", 0600, "$default_internal_user", "" },
b1aa228609f9afde184c7facc0c53e3cf6dbe1e3Timo Sirainen { "replicator-doveadm", 0, "$default_internal_user", "" }
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenstatic struct file_listener_settings *replicator_unix_listeners[] = {
99a9e14caaf54d884dac6a520111cfc8849d8323Timo Sirainen &replicator_unix_listeners_array[0],
99a9e14caaf54d884dac6a520111cfc8849d8323Timo Sirainen &replicator_unix_listeners_array[1]
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenstatic buffer_t replicator_unix_listeners_buf = {
da7f1a07f583df8905684a7b78469960afd7c78dPhil Carmody replicator_unix_listeners, sizeof(replicator_unix_listeners), { NULL, }
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen/* </settings checks> */
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenstruct service_settings replicator_service_settings = {
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .name = "replicator",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .protocol = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .type = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .executable = "replicator",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .user = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .group = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .privileged_group = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .extra_groups = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .chroot = "",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .drop_priv_before_exec = FALSE,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .process_min_avail = 0,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .process_limit = 1,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .client_limit = 0,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .service_count = 0,
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainen .idle_kill = UINT_MAX,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .vsz_limit = (uoff_t)-1,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .unix_listeners = { { &replicator_unix_listeners_buf,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen sizeof(replicator_unix_listeners[0]) } },
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .fifo_listeners = ARRAY_INIT,
3d4648e56d079f9778fc72450ccc604ffc05babcTimo Sirainen .inet_listeners = ARRAY_INIT,
3d4648e56d079f9778fc72450ccc604ffc05babcTimo Sirainen
3d4648e56d079f9778fc72450ccc604ffc05babcTimo Sirainen .process_limit_1 = TRUE
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#undef DEF
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen#define DEF(type, name) \
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen { type, #name, offsetof(struct replicator_settings, name), NULL }
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenstatic const struct setting_define replicator_setting_defines[] = {
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen DEF(SET_STR, auth_socket_path),
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen DEF(SET_STR, doveadm_socket_path),
36757b426f4761dbd837bdddc8998e22d09dc869Timo Sirainen DEF(SET_STR, replication_dsync_parameters),
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen DEF(SET_TIME, replication_full_sync_interval),
19e7781f15dbfe52387f40e26b75f938a7f2a7fcTimo Sirainen DEF(SET_UINT, replication_max_conns),
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen SETTING_DEFINE_LIST_END
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenconst struct replicator_settings replicator_default_settings = {
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .auth_socket_path = "auth-userdb",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .doveadm_socket_path = "doveadm-server",
36757b426f4761dbd837bdddc8998e22d09dc869Timo Sirainen .replication_dsync_parameters = "-d -N -l 30 -U",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
34d73a1789f9ecf5a159e7152d9d6aef35a7acc3Timo Sirainen .replication_full_sync_interval = 60*60*24,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .replication_max_conns = 10
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenconst struct setting_parser_info replicator_setting_parser_info = {
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .module_name = "replicator",
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .defines = replicator_setting_defines,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .defaults = &replicator_default_settings,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .type_offset = (size_t)-1,
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .struct_size = sizeof(struct replicator_settings),
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen .parent_offset = (size_t)-1
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen};
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainen
447e086422f1ab7cc16833583ed70a4af7a84bc5Timo Sirainenconst struct replicator_settings *replicator_settings;